Mercurial > octave-nkf
comparison scripts/statistics/base/var.m @ 8980:80d499b82ff3
fix typos in var.m
author | Jaroslav Hajek <highegg@gmail.com> |
---|---|
date | Sat, 14 Mar 2009 10:38:43 +0100 |
parents | f464119ec165 |
children | 16f53d29049f |
comparison
equal
deleted
inserted
replaced
8979:a7c00773a089 | 8980:80d499b82ff3 |
---|---|
39 ## @end deftypefn | 39 ## @end deftypefn |
40 | 40 |
41 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> | 41 ## Author: KH <Kurt.Hornik@wu-wien.ac.at> |
42 ## Description: Compute variance | 42 ## Description: Compute variance |
43 | 43 |
44 function y = var (x, opt, dim) | 44 function retval = var (x, opt, dim) |
45 | 45 |
46 if (nargin < 1 || nargin > 3) | 46 if (nargin < 1 || nargin > 3) |
47 print_usage (); | 47 print_usage (); |
48 endif | 48 endif |
49 if (nargin < 3) | 49 if (nargin < 3) |
54 endif | 54 endif |
55 if (nargin < 2 || isempty (opt)) | 55 if (nargin < 2 || isempty (opt)) |
56 opt = 0; | 56 opt = 0; |
57 endif | 57 endif |
58 | 58 |
59 n = size (a, dim); | 59 n = size (x, dim); |
60 if (n == 1) | 60 if (n == 1) |
61 retval = zeros (sz); | 61 retval = zeros (sz); |
62 elseif (numel (a) > 0) | 62 elseif (numel (x) > 0) |
63 retval = sumsq (center (a, dim), dim) / (n + opt - 1); | 63 retval = sumsq (center (x, dim), dim) / (n + opt - 1); |
64 else | 64 else |
65 error ("var: x must not be empty"); | 65 error ("var: x must not be empty"); |
66 endif | 66 endif |
67 | 67 |
68 endfunction | 68 endfunction |