<< distfun_norminv Normal distfun_normrnd >>

Distfun >> Distfun > Normal > distfun_normpdf

distfun_normpdf

Normal PDF

Calling Sequence

y=distfun_normpdf(x,mu,sigma)

Parameters

x :

a matrix of doubles, the outcome

mu :

a matrix of doubles, the mean

sigma :

a matrix of doubles, the standard deviation. sigma>0.

y :

a matrix of doubles, the density

Description

Computes the probability distribution function of the Normal (Laplace-Gauss) 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:

Examples

computed = distfun_normpdf ( [-1 1] , 0 , 1 )
expected = [ 0.241970724519143   0.241970724519143 ];
//
// Check expansion of mu and expansion of sigma
computed = distfun_normpdf ( [1 2 3] , 1.0 , 2.0 )
expected = [ ..
0.199471140200716, ..
0.176032663382150, ..
0.120985362259572 ..
];
// Check with expanded arguments
computed = distfun_normpdf ( [1 2 3] , [1 1 1], [2 2 2] )

// Plot the function
mu = [0 0 0 -2];
sigma2 = [0.2 1.0 5.0 0.5];
cols = [1 2 3 4];
nf = size(cols,"*");
lgd = [];
scf();
for k = 1 : nf
x = linspace(-5,5,1000);
y = distfun_normpdf ( x , mu(k) , sqrt(sigma2(k)) );
plot(x,y)
str = msprintf("mu=%s, sigma^2=%s",..
string(mu(k)),string(sigma2(k)));
lgd($+1) = str;
end
h = gcf();
for k = 1 : nf
hk = h.children.children.children(nf - k + 1);
hk.foreground = cols(k);
end
legend(lgd);
xtitle("Normal PDF","x","y")

Bibliography

http://en.wikipedia.org/wiki/Normal_distribution

Authors


Report an issue
<< distfun_norminv Normal distfun_normrnd >>