Statistics: normpdf

### Function Reference: `normpdf`

statistics: y = normpdf (x)
statistics: y = normpdf (x, mu)
statistics: y = normpdf (x, mu, sigma)

Normal probability density function (PDF).

For each element of x, compute the probability density function (PDF) of the normal distribution with mean mu and standard deviation sigma. The size of y is the common size of p, mu and sigma. A scalar input functions as a constant matrix of the same size as the other inputs.

Default values are mu = 0, sigma = 1.

Further information about the normal distribution can be found at https://en.wikipedia.org/wiki/Normal_distribution

See also: norminv, norminv, normrnd, normfit, normlike, normstat

Source Code: normpdf

### Example: 1

     ## Plot various PDFs from the normal distribution
     x = -5:0.01:5;
     y1 = normpdf (x, 0, 0.5);
     y2 = normpdf (x, 0, 1);
     y3 = normpdf (x, 0, 2);
     y4 = normpdf (x, -2, 0.8);
     plot (x, y1, "-b", x, y2, "-g", x, y3, "-r", x, y4, "-c")
     grid on
     xlim ([-5, 5])
     ylim ([0, 0.9])
     legend ({"μ = 0, σ = 0.5", "μ = 0, σ = 1", ...
              "μ = 0, σ = 2", "μ = -2, σ = 0.8"}, "location", "northeast")
     title ("Normal PDF")
     xlabel ("values in x")
     ylabel ("density")