Statistics Toolbox    
mahal

Mahalanobis distance

Syntax

Description

mahal(Y,X) computes the Mahalanobis distance of each point (row) of the matrix Y from the sample in the matrix X.

The number of columns of Y must equal the number of columns in X, but the number of rows may differ. The number of rows in X must exceed the number of columns.

The Mahalanobis distance is a multivariate measure of the separation of a data set from a point in space. It is the criterion minimized in linear discriminant analysis.

Example

The Mahalanobis distance of a matrix r when applied to itself is a way to find outliers.

The last element is clearly an outlier.

See Also
classify


  mad manova1