mahal
Mahalanobis distance to reference samples
Syntax
Description
returns the squared Mahalanobis
distance of each observation in d2
= mahal(Y
,X
)Y
to the reference
samples in X
.
Examples
Input Arguments
Output Arguments
More About
Tips
Each time you call the
mahal
function, it computes the covariance matrix of the reference samples. In cases where you want to compute Mahalanobis distances between multiple sets of data and the same reference samplesX
, you can save computing time by calculating the covariance matrix ofX
only once, and supplying it to thepdist2
function. For an example, see Compute Mahalanobis Distance.
Version History
Introduced before R2006a