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

  1. % function out = vebe(oper,mat)
  2. %
  3. %   Element-by-element operation on a VARYING/CONSTANT matrix,
  4. %   using standard MATLAB arithmetic functions with one input
  5. %   argument, such as SIN, ABS, REAL, SQRT, LOG, GAMMA, etc.
  6. %   OPER needs to be a character string, i.e. 'sin', 'abs', etc.
  7. %   
  8. %   See also: EBE, VABS, VDET, VDIAG, VREAL and VEVAL.
  9.  
  10. function out = vebe(oper,mat)
  11.  if nargin <= 1
  12.    disp('usage: out = vebe(oper,mat)')
  13.    return
  14.  end
  15.  if ~isstr(oper)
  16.    error(['first argument in VEBE should be a character string']);
  17.    return
  18.  end
  19.  [mtype,mrows,mcols,mnum] = minfo(mat);
  20.  if mtype == 'vary'
  21.    [nr,nc] = size(mat);
  22.    eval(['out = [' oper '(mat(1:nr-1,1:nc-1)) mat(1:nr-1,nc);mat(nr,1:nc)];']);
  23.  elseif mtype == 'syst'
  24.    error('VEBE is undefined for SYSTEM matrices')
  25.    return
  26.  else
  27.    eval(['out = ' oper '(mat);']);
  28.  end
  29. %
  30. % Copyright MUSYN INC 1991,  All Rights Reserved
  31.