Angle between two subspaces
theta = subspace(A,B)
theta = subspace(A,B) finds
the angle between two subspaces specified by the columns of
B are column vectors
of unit length, this is the same as
Consider two subspaces of a Hadamard matrix, whose columns are orthogonal.
H = hadamard(8); A = H(:,2:4); B = H(:,5:8);
Note that matrices
different sizes —
A has three columns and
It is not necessary that two subspaces be the same size in order to
find the angle between them. Geometrically, this is the angle between
two hyperplanes embedded in a higher dimensional space.
theta = subspace(A,B) theta = 1.5708
B are orthogonal
is shown by the fact that
theta is equal to π/2.
theta - pi/2 ans = 0
If the angle between the two subspaces is small, the two spaces
are nearly linearly dependent. In a physical experiment described
by some observations
A, and a second realization
of the experiment described by
a measure of the amount of new information afforded by the second
experiment not associated with statistical errors of fluctuations.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Usage notes and limitations:
Code generation does not support sparse matrix inputs for this function.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).