1## Copyright (C) 1995, 1996, 1997, 2006, 2007, 2009 Kurt Hornik
3## This file is part of Octave.
5## Octave is free software; you can redistribute it and/or modify it
6## under the terms of the GNU General Public License as published by
7## the Free Software Foundation; either version 3 of the License, or (at
8## your option) any later version.
10## Octave is distributed in the hope that it will be useful, but
11## WITHOUT ANY WARRANTY; without even the implied warranty of
12## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13## General Public License for more details.
15## You should have received a copy of the GNU General Public License
16## along with Octave; see the file COPYING. If not, see
17## <http://www.gnu.org/licenses/>.
20## @deftypefn {Function File} {} wblcdf (@var{x}, @var{scale}, @var{shape})
21## Compute the cumulative distribution function (CDF) at @var{x} of the
22## Weibull distribution with shape parameter @var{scale} and scale
23## parameter @var{shape}, which is
26## $$ 1 - \exp(-(x/shape)^{scale}) $$
31## 1 - exp(-(x/shape)^scale)
37## Author: KH <Kurt.Hornik@wu-wien.ac.at>
38## Description: CDF of the Weibull distribution
40function cdf = wblcdf (x, scale, shape)
42 if (nargin < 1 || nargin > 3)
54 if (!isscalar (shape) || !isscalar (scale))
55 [retval, x, shape, scale] = common_size (x, shape, scale);
57 error ("wblcdf: x, scale and shape must be of common size or scalar");
61 cdf = NaN * ones (size (x));
63 ok = ((shape > 0) & (shape < Inf) & (scale > 0) & (scale < Inf));
65 k = find ((x <= 0) & ok);
70 k = find ((x > 0) & (x < Inf) & ok);
72 if (isscalar (shape) && isscalar (scale))
73 cdf(k) = 1 - exp (- (x(k) / scale) .^ shape);
75 cdf(k) = 1 - exp (- (x(k) ./ scale(k)) .^ shape(k));
79 k = find ((x == Inf) & ok);