d = subspace(A, B)
| Parameter | Description |
|---|---|
| A | matrix whose columns span the first subspace (real or complex). |
| B | matrix whose columns span the second subspace (real or complex). |
| Parameter | Description |
|---|---|
| d | scalar measure of distance between the column spaces of A and B. d = 0 indicates identical subspaces; larger values indicate larger separation. |
subspace computes a scalar measure of the distance between the subspaces spanned by the columns of matrices A and B. The value is derived from the principal angles between the two subspaces (computed from orthonormal bases of the column spaces). This measure is useful to quantify how close two column spaces are; it is zero when the subspaces coincide.
% Two 2-D subspaces (columns)
A = [1 0; 0 1; 0 0]; % spans e1 and e2
B = [1 0; 0 0; 0 1]; % spans e1 and e3
d = subspace(A, B)
% d > 0 indicating the subspaces are different
| Version | Description |
|---|---|
| 1.15.0 | initial version |