Returns the Normal (Laplace-Gauss) probability distribution function.
p = normpdf ( x , mu , sigma )
n-by-m matrix of doubles, the outcome
n-by-m matrix of doubles, the mean (default mu=0)
n-by-m matrix of doubles, the standard deviation (default sigma=1)
a n-by-m matrix of doubles, the probability
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:
computed = scidemo_normpdf ( [-1 1] , zeros(1,2) , ones(1,2) ) expected = [ 0.241970724519143 0.241970724519143 ]; // Plot the function scf(); mu = [0 0 0 -2]; sigma2 = [0.2 1.0 5.0 0.5]; cols = [1 2 3 4]; nf = size(cols,"*"); lgd = []; nx = 1000; for k = 1 : nf x = linspace(-5,5,nx); y = scidemo_normpdf ( x , mu(k)*ones(1,nx) , sqrt(sigma2(k))*ones(1,nx) ); 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 h.children.children.children(nf - k + 1).foreground = cols(k); end legend(lgd); xtitle("Normal Probability Distribution Function","X","Probability") | ![]() | ![]() |