MATLAB Functions For Common Probability Distributions

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

I.

Normal distribution, Multivariate normal distribution


Syntax Function
normcdf Normal cumulative distribution function
normpdf Normal probability density function
mvncdf Multivariate normal cumulative distribution function
mvnpdf Multivariate normal probability density function
normrnd Normal random numbers
mvnrnd Multivariate normal random numbers
norminv Normal inverse cumulative distribution function

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.

5. R = normrnd(MU,SIGMA) returns an array of random numbers chosen from a normal


distribution with mean MU and standard deviation SIGMA. The size of R is the same as the size
of MU and SIGMA if both are arrays.

6. R = mvnrnd(MU,SIGMA) returns an N-by-D matrix R of random vectors chosen from the


multivariate normal distribution with mean vector MU, and covariance matrix SIGMA. D is the
number of random variables in the joint distributions and N is the number of random numbers
that are need for each variable.

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’

II. Lognormal distribution


Syntax Function
lognpdf Lognormal probability density function
logncdf Lognormal cumulative distribution function
lognrnd Lognormal random numbers
logninv Lognormal inverse cumulative distribution function

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.

2. P = logncdf(X,MU,SIGMA) returns values at X of the lognormal cdf with distribution


parameters MU and SIGMA. MU and SIGMA are the mean of the log (ln Y) and log-standard
deviation (ln Y), respectively.

3. R = lognrnd(MU,SIGMA) returns an array of random numbers generated from the lognormal


distribution with parameters MU and SIGMA. MU and SIGMA are the mean of the log (ln Y)
and log-standard deviation (ln Y), respectively.

4. X = logninv(P,MU,SIGMA) returns values at P of the inverse lognormal cdf 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

evaluated at the values in X.

2. P = raylcdf(X,B) returns the Rayleigh cumulative distribution function with parameter


evaluated at the values in X.


3. R = raylrnd(B) returns an array of random numbers chosen from the Rayleigh distribution with
parameter .

4. X = raylinv(P,B) returns the Rayleigh cumulative distribution function with parameter


at the probabilities in P.

V. Type I extreme (Gumbel) distribution

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.

VI. Triangular distribution


There are no built-in MATLAB commands for the triangular distribution. Use the expressions
for the pdf and cdf provided on Slide 4.15.

VII. Uniform distribution


Syntax Function
unifpdf Continuous uniform probability density function
unifcdf Continuous uniform cumulative distribution function
unidpdf Discrete uniform probability density function
unidcdf Discrete uniform cumulative distribution function
rand Uniformly distributed pseudorandom numbers
randi Uniformly distributed pseudorandom integers
unifinv Continuous uniform inverse cumulative distribution function
unidinv Discrete uniform inverse cumulative distribution function

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.

3. Y = unidpdf(X,N) returns the (discrete) uniform probability density function on (1,2,...,N) at


the values in X.
4. P = unidcdf(X,N) returns the cumulative distribution function for a random variable uniform
on (1,2,...,N), 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.

6. R = randi(IMAX,N) returns an N-by-N matrix containing pseudorandom integer values drawn


from the discrete uniform distribution on 1:IMAX. randi(IMAX,M,N) or randi(IMAX,[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).

VIII. Binomial distribution


Syntax Function
binopdf Binomial probability density function
binocdf Binomial cumulative distribution function
binornd Binomial random numbers
binoinv Binomial inverse cumulative distribution function

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.

2. Y=binocdf(X,N,P) returns the binomial cumulative distribution 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.

3. R = binornd(N,P,MM,NN) returns an array of random numbers chosen from a binomial


distribution with parameters N and P. N is the number of trials and P is the probability of success
in each trial.
4. X = binoinv(Y,N,P) returns the inverse of the binomial cdf with parameters N and P. Since the
binomial distribution is discrete, binoinv returns the least integer X such that the binomial cdf
evaluated at X, equals or exceeds Y. N is the number of trials and P is the probability of success
in each trial.

IX. Poisson distribution


Syntax Function
poisspdf Poisson probability density function
poisscdf Poisson cumulative distribution function
poissrnd Poisson random numbers
poissinv Poisson inverse cumulative distribution function

Note:
1. Y = poisspdf(X,LAMBDA) returns the Poisson probability density function with parameter
LAMBDA at the values in X.

2. P = poisscdf(X,LAMBDA) computes the Poisson cumulative distribution function with


parameter LAMBDA at the values in X.

3. R = poissrnd(LAMBDA) returns an array of random numbers chosen from the Poisson


distribution with parameter LAMBDA.

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy