home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / DATAFUN.DI$ / MEAN.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  358 b   |  16 lines

  1. function y = mean(x)
  2. %MEAN    Average or mean value.
  3. %    For vectors,  MEAN(X)  is the mean value of the elements in X.
  4. %    For matrices,  MEAN(X) is a row vector containing the mean value
  5. %    of each column.
  6. %
  7. %    See also MEDIAN, STD, MIN, MAX.
  8.  
  9. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  10.  
  11. [m,n] = size(x);
  12. if m == 1
  13.     m = n;
  14. end
  15. y = sum(x) / m;
  16.