comparison scripts/statistics/base/ppplot.m @ 11436:e151e23f73bc

Overhaul base statistics functions and documentation of same. Add or improve input validation. Add input validation tests. Add functional tests. Improve or re-write documentation strings.
author Rik <octave@nomad.inbox5.com>
date Mon, 03 Jan 2011 21:23:08 -0800
parents a1dbe9d80eee
children fd0a3ac60b0e
comparison
equal deleted inserted replaced
11435:20f53b3a558f 11436:e151e23f73bc
52 if (nargin < 1) 52 if (nargin < 1)
53 print_usage (); 53 print_usage ();
54 endif 54 endif
55 55
56 if (! isvector (x)) 56 if (! isvector (x))
57 error ("ppplot: x must be a vector"); 57 error ("ppplot: X must be a vector");
58 endif 58 endif
59 59
60 s = sort (x); 60 s = sort (x);
61 n = length (x); 61 n = length (x);
62 p = ((1 : n)' - 0.5) / n; 62 p = ((1 : n)' - 0.5) / n;
63 if (nargin == 1) 63 if (nargin == 1)
64 F = @stdnormal_cdf; 64 F = @stdnormal_cdf;
65 else 65 else
66 F = str2func (sprintf ("%s_cdf", dist)); 66 F = str2func (sprintf ("%scdf", dist));
67 endif; 67 endif;
68 if (nargin <= 2) 68 if (nargin <= 2)
69 y = feval (F, s); 69 y = feval (F, s);
70 else 70 else
71 y = feval (F, s, varargin{:}); 71 y = feval (F, s, varargin{:});
75 plot (p, y); 75 plot (p, y);
76 axis ([0, 1, 0, 1]); 76 axis ([0, 1, 0, 1]);
77 endif 77 endif
78 78
79 endfunction 79 endfunction
80
81 %% Test input validation
82 %!error ppplot ();
83 %!error ppplot (ones(2,2));
84