Mercurial > octave-nkf
comparison scripts/statistics/distributions/cauchy_cdf.m @ 12750:89d41b6aa661 stable
cauchy_cdf.m: Allow valid -Inf, Inf inputs.
* cauchy_cdf.m: Remove unnecessary test for input x > -Inf, x < Inf.
author | Rik <octave@nomad.inbox5.com> |
---|---|
date | Fri, 17 Jun 2011 22:56:22 -0700 |
parents | c792872f8942 |
children | d9b084a3d4b0 |
comparison
equal
deleted
inserted
replaced
12749:e7cc2d4a6db3 | 12750:89d41b6aa661 |
---|---|
46 endif | 46 endif |
47 | 47 |
48 sz = size (x); | 48 sz = size (x); |
49 cdf = NaN (sz); | 49 cdf = NaN (sz); |
50 | 50 |
51 k = find ((x > -Inf) & (x < Inf) & (location > -Inf) & | 51 k = find ((location > -Inf) & (location < Inf) |
52 (location < Inf) & (scale > 0) & (scale < Inf)); | 52 & (scale > 0) & (scale < Inf)); |
53 if (any (k)) | 53 if (any (k)) |
54 if (isscalar (location) && isscalar (scale)) | 54 if (isscalar (location) && isscalar (scale)) |
55 cdf(k) = 0.5 + atan ((x(k) - location) ./ scale) / pi; | 55 cdf(k) = 0.5 + atan ((x(k) - location) ./ scale) / pi; |
56 else | 56 else |
57 cdf(k) = 0.5 + atan ((x(k) - location(k)) ./ scale(k)) / pi; | 57 cdf(k) = 0.5 + atan ((x(k) - location(k)) ./ scale(k)) / pi; |