To calculate the normal distribution in Matlab, you can use the normpdf
or normcdf
function.
normpdf(x,mu,sigma)
returns the probability density function (PDF) at x of the normal distribution with mean mu
and standard deviation sigma
.
normcdf(x,mu,sigma)
returns the cumulative distribution function (CDF) at x of the normal distribution with mean mu
and standard deviation sigma
.
Here's an example code snippet that calculates and plots the PDF and CDF of the normal distribution with mean 0 and standard deviation 1:
main.m474 chars24 lines
This code will produce a figure with two subplots, one showing the PDF and the other showing the CDF.
gistlibby LogSnag