Documentation Center

  • Trial Software
  • Product Updates

mvnpdf

Multivariate normal probability density function

Syntax

y = mvnpdf(X)
y = mvnpdf(X,MU)
y = mvnpdf(X,MU,SIGMA)

Description

y = mvnpdf(X) returns the n-by-1 vector y, containing the probability density of the multivariate normal distribution with zero mean and identity covariance matrix, evaluated at each row of the n-by-d matrix X. Rows of X correspond to observations and columns correspond to variables or coordinates.

y = mvnpdf(X,MU) returns the density of the multivariate normal distribution with mean mu and identity covariance matrix, evaluated at each row of X. MU is a 1-by-d vector, or an n-by-d matrix. If MU is a matrix, the density is evaluated for each row of X with the corresponding row of MU. MU can also be a scalar value, which mvnpdf replicates to match the size of X.

y = mvnpdf(X,MU,SIGMA) returns the density of the multivariate normal distribution with mean MU and covariance SIGMA, evaluated at each row of X. SIGMA is a d-by-d matrix, or a d-by-d-by-n array, in which case the density is evaluated for each row of X with the corresponding page of SIGMA, i.e., mvnpdf computes y(i) using X(i,:) and SIGMA(:,:,i). If the covariance matrix is diagonal, containing variances along the diagonal and zero covariances off the diagonal, SIGMA may also be specified as a 1-by-d vector or a 1-by-d-by-n array, containing just the diagonal. Specify [] for MU to use its default value when you want to specify only SIGMA.

If X is a 1-by-d vector, mvnpdf replicates it to match the leading dimension of mu or the trailing dimension of SIGMA.

Examples

mu = [1 -1]; 
SIGMA = [.9 .4; .4 .3]; 
X = mvnrnd(mu,SIGMA,10); 
p = mvnpdf(X,mu,SIGMA); 

See Also

| |

Was this topic helpful?