To calculate the normal distribution in MATLAB, you can make use of the normpdf
function, which takes the following arguments:
main.m26 chars2 lines
where x
is a vector of values for which you want to calculate the probability density function, mu
is the mean of the distribution, and sigma
is the standard deviation.
For example, if you want to calculate the probability of a value x = 2
from a normal distribution with mu = 0
and sigma = 1
, you can use the following code:
main.m53 chars5 lines
The output y
will be the probability density function for the given x
, mu
, and sigma
.
gistlibby LogSnag