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

  1. % function out = vreal(mat)
  2. %
  3. %   Real part of VARYING/CONSTANT matrix, identical
  4. %   to MATLAB's REAL command, but VREAL works on
  5. %   VARYING matrices also.
  6. %
  7. %   See also: ABS, IMAG, REAL, VABS, VEBE, VEVAL, and VIMAG.
  8.  
  9. function out = vreal(mat)
  10.  if nargin ~= 1
  11.    disp('usage: out = vreal(mat)')
  12.    return
  13.  end
  14.  [mtype,mrows,mcols,mnum] = minfo(mat);
  15.  if mtype == 'vary'
  16.    [nr,nc] = size(mat);
  17.    out = [real(mat(1:nr-1,1:nc-1))  mat(1:nr-1,nc);...
  18.            mat(nr,1:nc)];
  19.  elseif mtype == 'syst'
  20.    error('VREAL is undefined for SYSTEM matrices')
  21.    return
  22.  else
  23.    out = real(mat);
  24.  end
  25. %
  26. % Copyright MUSYN INC 1991,  All Rights Reserved
  27.