SUBSPACE(A,B) finds the largest angle between two subspaces specified by the columns of A and B. If A and B are vectors of unit length, this is the same as COS(ABS(A'*B)) in exact arithmetic. This is a replacement for MATLAB's SUBSPACE.m Rev. 5.5-5.8 that fails to provide correct answers for angles smaller than e-8 and for Rev. 5.9-188.8.131.52 that fails to provide correct answers for angles close to pi/2.
Andrew Knyazev (2021). subspace.m (https://www.mathworks.com/matlabcentral/fileexchange/54-subspace-m), MATLAB Central File Exchange. Retrieved .
Thanks a lot.
The provided function SUBSPACE(A,B) has the exactly same functionality as MATLAB's SUBSPACE.m, i.e. computes the LARGEST angle only, but computes it accurately in the whole range of values from 0 to pi/2, in contrast to MATLAB's SUBSPACE.m.
To compute ALL angles accurately, as well as the corresponding principal vectors, use SUBSPACEA(A,B) from https://www.mathworks.com/matlabcentral/fileexchange/55-subspacea-m
No, this is completely fine. I was expecting other than the largest angles. But that part is included in "subspacea.m" which is great work.
"If A is not provided as a third argument, than A=I and the function gives the same largest angle as SUBSPACE.m"
Re: jyoti mundra, why 4 stars? Anything wrong that needs to be fixed or improved?
Thanks alot for your prompt response.
Actually I have check that link before, But I was not sure how do we decide matrix A in that case.
Re: jyoti mundra, thanks for your kind words!
Please see https://www.mathworks.com/matlabcentral/fileexchange/55-subspacea-m
How can we get other than largest angles from this code?
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!