Mercurial > hg > octave-terminal
changeset 7032:4d4197ffb09d
[project @ 2007-10-15 16:31:55 by jwe]
author | jwe |
---|---|
date | Mon, 15 Oct 2007 16:31:55 +0000 |
parents | 120f3135952f |
children | f0142f2afdc6 |
files | scripts/ChangeLog scripts/plot/print.m scripts/statistics/distributions/frnd.m |
diffstat | 3 files changed, 28 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -10,6 +10,9 @@ 2007-10-15 David Bateman <dbateman@free.fr> + * plot/print.m: Call drawnow before printing to ensure the plot is + on the screen. + * testfun/test.m: In error/warning blocks test for an error before a warning to avoid unexpected failures.
--- a/scripts/plot/print.m +++ b/scripts/plot/print.m @@ -128,6 +128,10 @@ debug = false; debug_file = "octave-print-commands.log"; + ## Ensure the last figure is on the screen for single line commands like + ## plot(...); print(...); + drawnow (); + for i = 1:nargin arg = varargin{i}; if (ischar (arg))
--- a/scripts/statistics/distributions/frnd.m +++ b/scripts/statistics/distributions/frnd.m @@ -78,16 +78,33 @@ if (isscalar (m) && isscalar (n)) - if ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) - rnd = n ./ m .* randg(m/2,sz) ./ randg(n/2,sz); + if (isinf (m) || isinf (n)) + if (isinf (m)) + rnd = ones (sz); + else + rnd = 2 ./ m .* randg(m / 2, sz); + endif + if (! isinf (n)) + rnd = 0.5 .* n .* rnd ./ randg (n / 2, sz); + endif + elseif ((m > 0) && (m < Inf) && (n > 0) && (n < Inf)) + rnd = n ./ m .* randg (m / 2, sz) ./ randg (n / 2, sz); else rnd = NaN * ones (sz); endif else rnd = zeros (sz); - k = find (!(m > 0) | !(m < Inf) | - !(n > 0) | !(n < Inf)); + k = find (isinf(m) | isinf(n)); + if (any (k)) + rnd (k) = 1; + k2 = find (!isinf(m) & isinf(n)); + rnd (k2) = 2 ./ m(k2) .* randg (m(k2) ./ 2, size(k2)); + k2 = find (isinf(m) & !isinf(n)); + rnd (k2) = 0.5 .* n(k2) .* rnd(k2) ./ randg (n(k2) ./ 2, size(k2)); + endif + + k = find (!(m > 0) | !(n > 0)); if (any (k)) rnd(k) = NaN; endif