This is a nice short code, but it covers only a very special case and does not tell which one exactly.
I recommend spincalc() from Jonathan Fuller. It is much more powerfull!

This is a nice short code, but it covers only a very special case and does not tell which one exactly.
I recommend spincalc() from Jonathan Fuller. It is much more powerfull!
http://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors

I'm wondering how you tested the LSMR algorithm with the sparse Matrices? Please let me know.
I checked, by MATLAB, the result of one matrix (produced by mesh2d2.m) from this site: http://www.cise.ufl.edu/research/sparse
and the result was not good at all.

Fantastic! I would only like to pass an initial start guess to the function, so for me I changed the interface to lsmr(..., x0) and in the code I put a
if ~isempty(x0)
x = x0; clear x0
else
x = zeros(n,1);
end
Very useful code, thank you!

Comment only