The cumulative distribution function (CDF) can be calculated in MATLAB using the cdf
function from the Statistics and Machine Learning Toolbox.
The basic syntax for calculating the CDF is as follows:
main.m34 chars2 lines
Here, type
is a string scalar or character vector specifying the name of the probability distribution that you want to use. x
is the vector of values at which to evaluate the CDF, and param1
, param2
, etc. are the parameters of the specified distribution.
For example, to calculate the CDF of a normal distribution with mean 0 and standard deviation 1 at the values -2, -1, 0, 1, and 2, you could use the following code:
main.m181 chars6 lines
This code will generate a plot of the normal CDF at the specified values of x
.
gistlibby LogSnag