home *** CD-ROM | disk | FTP | other *** search
/ Borland Programmer's Resource / Borland_Programmers_Resource_CD_1995.iso / utils / mathstud / rank.m < prev    next >
Encoding:
Text File  |  1995-05-19  |  248 b   |  13 lines

  1. function rv = rank(x,tol)
  2. %rv=rank(x,tol)
  3. %computes the rank of the matrix x (using SVD)
  4.  
  5. %       S.Halevy 7/31/92
  6. %       Copyright (c) 1992 by the MathWizards
  7.  
  8. s = svd(x);
  9. if nargin<2
  10.    tol=max(size(x))*s(1)*eps; 
  11. end
  12. rv=sum(s>tol);
  13.