function [B] = alignMat(M); % [B] = alignMat(M); % Return a 3x3 matrix B that aligns (right multiplying) % the first 2 rows of M to the "identity matrix". % See matrix computations (3rd edition), pp. 601. F = size(M,1)/2; C = [M(1,:);M(F+1,:)]'*[1 0 0; 0 1 0]; [u,s,v] = svd(C); B = u*v';