Weibull PDF
y = distfun_wblpdf ( x , a , b )
a matrix of doubles, the outcome, x>=0
a matrix of doubles, the scale parameter, a>0.
a matrix of doubles, the shape parameter, b>0.
a matrix of doubles, the density
Computes the Weibull probability distribution function.
Any scalar input argument is expanded to a matrix of doubles of the same size as the other input arguments.
The function definition is:
if x>=0.
If b=1, this corresponds to the Exponential distribution.
If b=2, this corresponds to the Rayleigh distribution.
The value of the density at x=0 depends on b.
If 0<b<1, then f(x) → infinity when x → zero.
If b=1, then f(x) → 1/a when x → zero.
If b>1, then f(x) → zero when x → zero.
Compatibility
This distribution has the same parameters as in Matlab.
In R, the parameters a and b are switched, so that the statement in distfun :
is the same as the statement in R :
// Check with a and b to be expanded computed = distfun_wblpdf ( 0.1:0.2:0.7 , 2 , 3 ) expected = [0.0037495 0.0336363 0.0922965 0.1760382] // Plot the function a = 1; b = [0.5 1 1.5 5]; cols = [1 2 3 5]; nf = size(cols,"*"); lgd = []; scf(); for k = 1 : nf x = linspace(0,2.5,1000); y = distfun_wblpdf(x,a,b(k)); plot(x,y) str = msprintf("a=%s, b=%s",.. string(a),string(b(k))); lgd($+1) = str; end h = gcf(); for k = 1 : nf hk = h.children.children.children(nf - k + 1); hk.foreground = cols(k); end xtitle("Weibull PDF","x","y"); legend(lgd); h.children.data_bounds=[0,0;2.5,2.5]; | ![]() | ![]() |