home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS1.DI$ / VRCOND.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.1 KB  |  40 lines

  1. % function out = vrcond(mat)
  2. %
  3. %   Estimate of condition number of a VARYING/CONSTANT 
  4. %   matrix. Identical to MATLAB's RCOND command, but 
  5. %   works with VARYING matrices also.
  6. %
  7. %   See also: COND, DET, RCOND, SVD, VCOND, VDET, VNORM and VSVD.
  8.  
  9. function out = vrcond(mat)
  10.   if nargin == 0
  11.     disp('usage: out = vrcond(mat)')
  12.     return
  13.   end
  14.   [mtype,mrows,mcols,mnum] = minfo(mat);
  15.   [nr,nc] = size(mat);
  16.     if mtype == 'cons'
  17.       out = rcond(mat);
  18.     elseif mtype == 'vary'
  19.       npts = mnum;
  20.       nrout = 1;
  21.       ncout = 1;
  22.       out = zeros(npts+1,ncout+1);
  23.       out(npts+1,ncout+1) = inf;
  24.       out(npts+1,ncout) = npts;
  25.       out(1:npts,ncout+1) = mat(1:mnum,nc);
  26.       ftop = (npts+1)*mrows;
  27.       ptop = 1:mrows:ftop;
  28.       ptopm1 = ptop(2:npts+1) - 1;
  29.       for i=1:npts
  30.         out(i,1) = rcond(mat(ptop(i):ptopm1(i),1:mcols));
  31.       end
  32.     elseif mtype == 'syst'
  33.       error('VRCOND is undefined for SYSTEM matrices')
  34.       return
  35.     else
  36.       out = [];
  37.     end
  38. %
  39. % Copyright MUSYN INC 1991,  All Rights Reserved
  40.