Mercurial > octave-nkf
comparison scripts/statistics/distributions/binomial_rnd.m @ 4856:c89b9abf2ffd
[project @ 2004-04-08 03:24:12 by jwe]
author | jwe |
---|---|
date | Thu, 08 Apr 2004 03:24:12 +0000 |
parents | 4b0f3b055331 |
children | 9794d526639c |
comparison
equal
deleted
inserted
replaced
4855:d62c421f448b | 4856:c89b9abf2ffd |
---|---|
49 endif | 49 endif |
50 if (! (isscalar (c) && (c > 0) && (c == round (c)))) | 50 if (! (isscalar (c) && (c > 0) && (c == round (c)))) |
51 error ("binomial_rnd: c must be a positive integer"); | 51 error ("binomial_rnd: c must be a positive integer"); |
52 endif | 52 endif |
53 sz = [r, c]; | 53 sz = [r, c]; |
54 | |
55 if (any (size (n) != 1) && ((length (size (n)) != length (sz)) || | |
56 any (size (n) != sz))) | |
57 error ("binomial_rnd: n and must be scalar or of size [r, c]"); | |
58 endif | |
54 elseif (nargin == 3) | 59 elseif (nargin == 3) |
55 if (isscalar (r) && (r > 0)) | 60 if (isscalar (r) && (r > 0)) |
56 sz = [r, r]; | 61 sz = [r, r]; |
57 elseif (isvector(r) && all (r > 0)) | 62 elseif (isvector(r) && all (r > 0)) |
58 sz = r(:)'; | 63 sz = r(:)'; |
59 else | 64 else |
60 error ("binomial_rnd: r must be a postive integer or vector"); | 65 error ("binomial_rnd: r must be a postive integer or vector"); |
66 endif | |
67 | |
68 if (any (size (n) != 1) && ((length (size (n)) != length (sz)) || | |
69 any (size (n) != sz))) | |
70 error ("binomial_rnd: n and must be scalar or of size sz"); | |
61 endif | 71 endif |
62 elseif (nargin == 2) | 72 elseif (nargin == 2) |
63 sz = size(n); | 73 sz = size(n); |
64 else | 74 else |
65 usage ("binomial_rnd (n, p, r, c)"); | 75 usage ("binomial_rnd (n, p, r, c)"); |