MATLAB Functions For Common Probability Distributions
MATLAB Functions For Common Probability Distributions
MATLAB Functions For Common Probability Distributions
Note:
1. P = normcdf(X,MU,SIGMA) returns the cdf of the normal distribution with mean MU and
standard deviation SIGMA, evaluated at the values in X.
2. Y = normpdf(X,MU,SIGMA) returns the pdf of the normal distribution with mean MU and
standard deviation SIGMA, evaluated at the values in X.
3. Y = mvncdf(X,MU,SIGMA) returns the cdf of the multivariate normal distribution with mean
vector MU and covariance matrix SIGMA, evaluated at each row of X. MU is a 1-by-D vector,
and SIGMA is a D-by-D symmetric, positive definite matrix where D is the number of random
variables in the joint distribution.
4. Y = mvnpdf(X,MU,SIGMA) returns the pdf of the multivariate normal distribution with mean
vector MU and covariance matrix SIGMA, evaluated at each row of X.
7. X = norminv(P,MU,SIGMA) returns the inverse cdf for the normal distribution with mean
MU and standard deviation SIGMA, evaluated at the values in P.
8. You can enter ‘help syntax’ in MATLAB command window to find more details, eg: ‘help
normcdf’
Note:
1. Y = lognpdf(X,MU,SIGMA) returns values at X of the lognormal pdf with distribution
parameters MU and SIGMA. MU and SIGMA are the mean of the log (ln Y) and log-standard
deviation (ln Y), respectively.
5. Results 1 through 4 for the lognormal distribution can also be obtained using the commands
related to the normal distribution. For example P = normcdf (ln (X), MU,SIGMA) also returns
the lognormal cdf (same as (2) above). MU and SIGMA are the mean of the log (ln Y) and log-
standard deviation (ln Y), respectively.
III. Exponential distribution
Syntax Function
exppdf Exponential probability density function
expcdf Exponential cumulative distribution function
exprnd Exponential random numbers
expinv Exponential inverse cumulative distribution function
Note:
1. Y = exppdf(X,MU) returns the pdf of the exponential distribution with mean parameter MU,
evaluated at the values in X.
2. P = expcdf(X,MU) returns the cdf of the exponential distribution with mean parameter MU,
evaluated at the values in X.
3. R = exprnd(MU) returns an array of random numbers chosen from the exponential distribution
with mean parameter MU. The size of R is the size of MU.
4. X = expinv(P,MU) returns the inverse cdf of the exponential distribution with mean parameter
MU, evaluated at the values in P.
IV Rayleigh distribution
Syntax Function
raylpdf Rayleigh probability density function
raylcdf Rayleigh cumulative distribution function
raylrnd Rayleigh random numbers
raylinv Rayleigh inverse cumulative distribution function
Note:
1. Y = raylpdf(X,B) returns the Rayleigh probability density function with parameter
√
at the probabilities in P.
DO NOT use the built-in MATLAB command for the extreme value distribution. Use the
expressions for the cdf and pdf provided on Slide 4.19.
Note:
1. Y = unifpdf(X,A,B) returns the continuous uniform pdf on the interval [A,B] at the values in
X. By default A = 0 and B = 1.
2. P = unifcdf(X,A,B) returns the cdf for the uniform distribution on the interval [A,B] at the
values in X.
5. R = rand(N) returns an N-by-N matrix containing pseudorandom values drawn from the
standard uniform distribution on the open interval(0,1). rand(M,N) or rand([M,N]) returns an M-
by-N matrix.
7. X = unifinv(P,A,B) returns the inverse of the uniform (continuous) distribution function on the
interval [A,B], at the values in P. By default A = 0 and B = 1.
8. X = unidinv(P,N) returns the inverse of the uniform (discrete) distribution function at the
values in P. X takes the values (1,2,...,N).
Note:
1. Y = binopdf(X,N,P) returns the binomial probability density function with parameters N and P
at the values in X. N is the number of trials and P is the probability of success in each trial. Note
that the density function is zero unless X is an integer.
Note:
1. Y = poisspdf(X,LAMBDA) returns the Poisson probability density function with parameter
LAMBDA at the values in X.
4. X = poissinv(P,LAMBDA) returns the inverse of the Poisson cdf with parameter lambda.
Since the Poisson distribution is discrete, poissinv returns the smallest value of X, such that the
Poisson cdf evaluated, at X, equals or exceeds P.