Normal probability density function
collapse all in page
Syntax
y = normpdf(x)
y = normpdf(x,mu)
y = normpdf(x,mu,sigma)
Description
example
y = normpdf(x)
returns the probability density function (pdf) of the standard normal distribution, evaluated at the values in x
.
y = normpdf(x,mu)
returns the pdf of the normal distribution with mean mu
and the unit standard deviation, evaluated at the values in x
.
example
y = normpdf(x,mu,sigma)
returns the pdf of the normal distribution with mean mu
and standard deviation sigma
, evaluated at the values in x
.
Examples
collapse all
Standard Normal Distribution pdf
Open Live Script
Compute the pdf values for the standard normal distribution at the values in x
.
x = [-2,-1,0,1,2];y = normpdf(x)
y = 1×5 0.0540 0.2420 0.3989 0.2420 0.0540
Normal Distribution pdf
Open Live Script
Compute the pdf values evaluated at the values in x
for the normal distribution with mean mu
and standard deviation sigma
.
x = [-2,-1,0,1,2];mu = 2;sigma = 1;y = normpdf(x,mu,sigma)
y = 1×5 0.0001 0.0044 0.0540 0.2420 0.3989
Compute the pdf values evaluated at zero for various normal distributions with different mean parameters.
mu = [-2,-1,0,1,2];sigma = 1;y = normpdf(0,mu,sigma)
y = 1×5 0.0540 0.2420 0.3989 0.2420 0.0540
Input Arguments
collapse all
x
— Values at which to evaluate pdf
scalar value | array of scalar values
Values at which to evaluate the pdf, specified as a scalar value or an array of scalar values.
To evaluate the pdf at multiple values, specify x
using an array. To evaluate the pdfs of multiple distributions, specify mu and sigma using arrays. If one or more of the input arguments x
, mu
, and sigma
are arrays, then the array sizes must be the same. In this case, normpdf
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 mu
and sigma
, evaluated at the corresponding element in x
.
Example: [-1,0,3,4]
Data Types: single
| double
mu
— Mean
0
(default) | scalar value | array of scalar values
Mean of the normal distribution, specified as a scalar value or an array of scalar values.
To evaluate the pdf at multiple values, specify x using an array. To evaluate the pdfs of multiple distributions, specify mu
and sigma using arrays. If one or more of the input arguments x
, mu
, and sigma
are arrays, then the array sizes must be the same. In this case, normpdf
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 mu
and sigma
, evaluated at the corresponding element in x
.
Example: [0 1 2; 0 1 2]
Data Types: single
| double
sigma
— Standard deviation
1
(default) | positive scalar value | array of positive scalar values
Standard deviation of the normal 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 mu and sigma
using arrays. If one or more of the input arguments x
, mu
, and sigma
are arrays, then the array sizes must be the same. In this case, normpdf
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 mu
and sigma
, evaluated at the corresponding element in x
.
Example: [1 1 1; 2 2 2]
Data Types: single
| double
Output Arguments
collapse all
More About
collapse all
Normal Distribution
The normal distribution is a two-parameter family of curves. The first parameter, µ, is the mean. The second parameter, σ, is the standard deviation.
The standard normal distribution has zero mean and unit standard deviation.
The normal probability density function (pdf) is
The likelihood function is the pdf viewed as a function of the parameters. The maximum likelihood estimates (MLEs) are the parameter estimates that maximize the likelihood function for fixed values of x
.
Alternative Functionality
normpdf
is a function specific to normal distribution. Statistics and Machine Learning Toolbox™ also offers the generic function pdf, which supports various probability distributions. To usepdf
, create a NormalDistribution 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 functionnormpdf
is faster than the generic functionpdf
.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.
References
[1] Evans, M., N. Hastings, and B. Peaco*ck. Statistical Distributions. 2nd ed. Hoboken, NJ: John Wiley & Sons, Inc., 1993.
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
GPU Arrays
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Version History
Introduced before R2006a
See Also
pdf | normcdf | norminv | normrnd | mvnpdf | NormalDistribution | normspec
Topics
- Normal Distribution
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- Deutsch
- English
- Français
- United Kingdom (English)
Contact your local office