sem - Compute standard error of the mean (SEM). USAGE s = sem(x) x vector or matrix over which the SEM should be computed
0001 function s = sem(x) 0002 0003 %sem - Compute standard error of the mean (SEM). 0004 % 0005 % USAGE 0006 % 0007 % s = sem(x) 0008 % 0009 % x vector or matrix over which the SEM should be computed 0010 0011 % Copyright (C) 2008-2013 by Michaƫl Zugaro 0012 % 0013 % This program is free software; you can redistribute it and/or modify 0014 % it under the terms of the GNU General Public License as published by 0015 % the Free Software Foundation; either version 3 of the License, or 0016 % (at your option) any later version. 0017 0018 if nargin < 1, 0019 error('Incorrect number of parameters (type ''help <a href="matlab:help sem">sem</a>'' for details).'); 0020 end 0021 0022 if ~isdmatrix(x) & ~isdvector(x), 0023 error('Incorrect input - use vector or matrix (type ''help <a href="matlab:help sem">sem</a>'' for details).'); 0024 end 0025 0026 if any(size(x)==1), x = x(:); end 0027 0028 s = std(x)/sqrt(size(x,1));