# HG changeset patch # User Rik # Date 1479046566 28800 # Node ID c38eb3b082848e37c541141e11a6d073d32e1666 # Parent 50fa2d6563269b708e805f135403b2c3d7add901 ppplot.m, qqplot.m: Add @seealso section. Add BIST tests for input validation.. * ppplot.m, qqplot.m: Add @seealso section. Add BIST tests for input validation.. diff -r 50fa2d656326 -r c38eb3b08284 scripts/statistics/base/ppplot.m --- a/scripts/statistics/base/ppplot.m Sun Nov 13 06:07:14 2016 -0800 +++ b/scripts/statistics/base/ppplot.m Sun Nov 13 06:16:06 2016 -0800 @@ -44,6 +44,7 @@ ## calculates the CDF of distribution @var{dist} exists. ## ## If no output is requested then the data are plotted immediately. +## @seealso{qqplot} ## @end deftypefn ## Author: KH @@ -64,9 +65,12 @@ p = ((1 : n)' - 0.5) / n; if (nargin == 1) F = @stdnormal_cdf; + else if (! ischar (dist)) + error ("ppplot: DIST must me a string"); else - F = str2func (sprintf ("%scdf", dist)); + F = str2func ([dist "cdf"]); endif; + if (nargin <= 2) y = feval (F, s); else @@ -84,4 +88,5 @@ ## Test input validation %!error ppplot () %!error ppplot (ones (2,2)) +%!error ppplot (1, 2) diff -r 50fa2d656326 -r c38eb3b08284 scripts/statistics/base/qqplot.m --- a/scripts/statistics/base/qqplot.m Sun Nov 13 06:07:14 2016 -0800 +++ b/scripts/statistics/base/qqplot.m Sun Nov 13 06:16:06 2016 -0800 @@ -51,6 +51,7 @@ ## @var{dist}. ## ## If no output arguments are given, the data are plotted directly. +## @seealso{ppplot} ## @end deftypefn ## Author: KH @@ -111,3 +112,10 @@ endfunction + +## Test input validation +%!error qqplot () +%!error qqplot ({1}) +%!error qqplot (ones (2,2)) +%!error qqplot (1, "foobar") +