hecks if the input matrix is orthogonal and then determines the Euler angles analytically from the matrix elements. If the input matrix is close to orthogonal, <code>eulang</code> replaces it by its closest orthogonal neighbor using singular-value decomposition. If the the matrix is too far from orthogonal, <code>eulang</code> errors.
</p>

<p>
You can manually use SVD to orthogonalize a matrix using
</p>

<pre class="matlab">
[U,~,V] = svd(R);  % calculate SVD, ignoring singular values
R = U*V.';         %