# wblpdf

Weibull probability density function

## Description

example

y = wblpdf(x) returns the probability density function (pdf) of the Weibull distribution with unit parameters, evaluated at the values in x.

example

y = wblpdf(x,a) returns the pdf of the Weibull distribution with scale parameter a and unit shape, evaluated at the values in x. This is equivalent to the pdf of the exponential distribution.

example

y = wblpdf(x,a,b) returns the pdf of the Weibull distribution with scale parameter a and shape parameter b, evaluated at the values in x.

## Examples

collapse all

Compute the density of the observed value 3 in the Weibull distribution unit scale and shape.

y1 = wblpdf(3)
y1 = 0.0498

Compute the density of the observed value 3 in the Weibull distributions with scale parameter 2 and shape parameters 1 through 5.

y2 = wblpdf(3,2,1:5)
y2 = 1×5

0.1116    0.1581    0.1155    0.0427    0.0064

The exponential distribution with parameter mu is a special case of the Weibull distribution, where a = mu and b = 1.

Compute the density of sample observations in the exponential distributions with means 1 through 5 using expcdf.

x = 0.2:0.2:1;
mu = 1:5;
y1 = exppdf(x,mu)
y1 = 1×5

0.8187    0.4094    0.2729    0.2047    0.1637

Compute the density of the same sample observations using wblpdf where the scale parameter is equal to mu and the shape parameter is 1.

y2 = wblpdf(x,mu)
y2 = 1×5

0.8187    0.4094    0.2729    0.2047    0.1637

The two functions return the same values.

## Input Arguments

collapse all

Values at which to evaluate the pdf, specified as a nonnegative scalar value or an array of nonnegative scalar values.

• To evaluate the pdf at multiple values, specify x using an array.

• To evaluate the pdfs of multiple distributions, specify a and b using arrays.

If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblpdf expands each scalar input into a constant array of the same size as the array inputs. Each element in y is the pdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Example: [3 4 7 9]

Data Types: single | double

Scale parameter of the Weibull distribution, specified as a positive scalar value or an array of positive scalar values.

• To evaluate the pdf at multiple values, specify x using an array.

• To evaluate the pdfs of multiple distributions, specify a and b using arrays.

If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblpdf expands each scalar input into a constant array of the same size as the array inputs. Each element in y is the pdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Example: [1 2 3 5]

Data Types: single | double

Shape parameter of the Weibull distribution, specified as a positive scalar value or an array of positive scalar values.

• To evaluate the pdf at multiple values, specify x using an array.

• To evaluate the pdfs of multiple distributions, specify a and b using arrays.

If one or more of the input arguments x, a, and b are arrays, then the array sizes must be the same. In this case, wblpdf expands each scalar input into a constant array of the same size as the array inputs. Each element in y is the pdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

Example: [1 1 2 2]

Data Types: single | double

## Output Arguments

collapse all

pdf values evaluated at the values in x, returned as a scalar value or an array of scalar values. y is the same size as x, a, and b after any necessary scalar expansion. Each element in y is the pdf value of the distribution specified by the corresponding elements in a and b, evaluated at the corresponding element in x.

collapse all

### Weibull pdf

The Weibull distribution is a two-parameter family of curves. The parameters a and b are scale and shape, respectively.

The Weibull pdf is

$f\left(x|a,b\right)=\frac{b}{a}{\left(\frac{x}{a}\right)}^{b-1}{e}^{-{\left(x/a\right)}^{b}}.$

Some instances refer to the Weibull distribution with a single parameter, which corresponds to wblpdf with a = 1.

## Alternative Functionality

• wblpdf is a function specific to the Weibull distribution. Statistics and Machine Learning Toolbox™ also offers the generic function pdf, which supports various probability distributions. To use pdf, create a WeibullDistribution probability distribution object and pass the object as an input argument or specify the probability distribution name and its parameters. Note that the distribution-specific function wblpdf is faster than the generic function pdf.

• Use the Probability Distribution Function app to create an interactive plot of the cumulative distribution function (cdf) or probability density function (pdf) for a probability distribution.