comparison scripts/statistics/base/moment.m @ 6046:34f96dd5441b

[project @ 2006-10-10 16:10:25 by jwe]
author jwe
date Tue, 10 Oct 2006 16:10:31 +0000
parents e9cde940b271
children 93c65f2a5668
comparison
equal deleted inserted replaced
6045:421d8a903df7 6046:34f96dd5441b
46 ## Description: Compute moments 46 ## Description: Compute moments
47 47
48 function m = moment (x, p, opt1, opt2) 48 function m = moment (x, p, opt1, opt2)
49 49
50 if ((nargin < 2) || (nargin > 4)) 50 if ((nargin < 2) || (nargin > 4))
51 usage ("moment (x, p, type, dim)"); 51 print_usage ();
52 endif 52 endif
53 53
54 need_dim = 0; 54 need_dim = 0;
55 55
56 if (nargin == 2) 56 if (nargin == 2)
70 dim = opt2; 70 dim = opt2;
71 elseif (ischar (opt2)) 71 elseif (ischar (opt2))
72 opt = opt2; 72 opt = opt2;
73 dim = opt1; 73 dim = opt1;
74 else 74 else
75 usage ("moment: expecting opt to be a string"); 75 error ("moment: expecting opt to be a string");
76 endif 76 endif
77 else 77 else
78 usage ("moment (x, p, dim, opt)"); 78 print_usage ();
79 endif 79 endif
80 80
81 if (need_dim) 81 if (need_dim)
82 t = find (size (x) != 1); 82 t = find (size (x) != 1);
83 if (isempty (t)) 83 if (isempty (t))