Mahalanobis distance dimension question

5 views (last 30 days)
Mike Yeager
Mike Yeager on 14 Apr 2016
Answered: Roger Stafford on 14 Apr 2016
The documentation for this function says that X must have more rows than columns. Can someone explain to me why this is mathematically so?

Answers (1)

Roger Stafford
Roger Stafford on 14 Apr 2016
The reason is that matlab must compute the covariance of the matrix X and then find the inverse of this covariance matrix in order to compute the mahalanobis distance of Y from X. Unfortunately, if there are not more more rows than columns in X - that is to say, more observations than variables - its covariance matrix will be singular, that is, its determinant will be zero. That will make it impossible to find its inverse.
For an explanation of the mahalanobis distance see the site:
https://en.wikipedia.org/wiki/Mahalanobis_distance

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!