]> Creatis software - CreaPhase.git/blob - octave_packages/nan-2.5.5/sumsq.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / nan-2.5.5 / sumsq.m
1 function [o]=sumsq(x,DIM)
2 % SUMSQ calculates the sum of squares.
3
4 % [y] = sumsq(x [,  DIM])
5
6 % DIM   dimension
7 %       N STD of  N-th dimension 
8 %       default or []: first DIMENSION, with more than 1 element
9 %
10 % y     estimated standard deviation
11 %
12 % features:
13 % - can deal with NaN's (missing values)
14 % - dimension argument also in Octave
15 % - compatible to Matlab and Octave
16 %
17 % see also: RMS, SUMSKIPNAN, MEAN, VAR, MEANSQ,
18 %
19 %
20 % References(s):
21
22
23 %    This program is free software; you can redistribute it and/or modify
24 %    it under the terms of the GNU General Public License as published by
25 %    the Free Software Foundation; either version 2 of the License, or
26 %    (at your option) any later version.
27 %
28 %    This program is distributed in the hope that it will be useful,
29 %    but WITHOUT ANY WARRANTY; without even the implied warranty of
30 %    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
31 %    GNU General Public License for more details.
32 %
33 %    You should have received a copy of the GNU General Public License
34 %    along with this program; If not, see <http://www.gnu.org/licenses/>.
35
36 %       $Id$
37 %       Copyright (C) 2009,2010 by Alois Schloegl <alois.schloegl@gmail.com>    
38 %       This function is part of the NaN-toolbox
39 %       http://pub.ist.ac.at/~schloegl/matlab/NaN/
40
41 if nargin<2,
42         DIM = []; 
43 end;
44 if isempty(DIM), 
45         DIM = find(size(x)>1,1);
46         if isempty(DIM), DIM=1; end;
47 end;
48
49 [s,n,o] = sumskipnan(x,DIM);
50