A couple of years ago I used this function (maybe I copied the Matlab or Octave code, I don't remember):
*## similar to the Matlab orth() function* *function orth(A)* * if (isempty (A))* * retval = []* * else* * (U, S, V) = svd(A) * * (rows, cols) = size(A) * * tol = max (size (A)) * S[1] * eps()* * r = sum (S .> tol)* * if (r >0)* * retval = -U[:,1:r]* * else* * retval = zeros(rows, 0);* * end* * end* *return(retval)* *end*
