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

  1. % function out = vnorm(matin,p)
  2. %
  3. %   Norm of a VARYING matrix. VNORM operates just as NORM
  4. %   does in standard MATLAB, but on VARYING matrices also.
  5. %   The option P denotes the norm desired. The default is the
  6. %   infinity norm of MATIN just as with NORM.
  7. %
  8. %   See also: NORM, PKVNORM, VRHO, and VSVD.
  9.  
  10. function out = vnorm(matin,p)
  11.  if nargin == 0
  12.    disp('usage: out = vnorm(matin,p)');
  13.    return
  14.  end
  15.  [mtype,mrows,mcols,mnum] = minfo(matin);
  16.  if nargin == 1
  17.    p = 2;
  18.  end
  19.  if mtype == 'cons'
  20.    out = norm(matin,p);
  21.  elseif mtype == 'vary'
  22.    npts = mnum;
  23.    nrout = mnum;
  24.    ncout = 2;
  25.    out = zeros(npts+1,2);
  26.    ff = (npts+1)*mrows;
  27.    pt = 1:mrows:ff;
  28.    ptm1 = pt(2:npts+1)-1;
  29.    for i=1:npts
  30.      out(i,1) = norm(matin(pt(i):ptm1(i),1:mcols),p);
  31.    end
  32.    out(1:npts,2) = matin(1:npts,mcols+1);
  33.    out(npts+1,1) = npts;
  34.    out(npts+1,2) = inf;
  35.  elseif mtype == 'syst'
  36.    error('VNORM is undefined for SYSTEM matrices');
  37.    return
  38.  else
  39.    out = [];
  40.  end
  41. %
  42. % Copyright MUSYN INC 1991,  All Rights Reserved
  43.