This code demonstrates Mahalanobis distance.
The Mahalanobis distance is a measure of the distance between a point P and a distribution D, introduced by P. C. Mahalanobis in 1936. It is a multi-dimensional generalization of the idea of measuring how many standard deviations away P is from the mean of D. This distance is zero if P is at the mean of D, and grows as P moves away from the mean. (Wikipedia)
See p. 80 in the text book Pattern Recognition and Machine learning by Christoper Bishop.
run the code "ch2_3_p80_Mahalanobisdistance.m"
Download MATLAB code here :