Announce

PukiWiki contents have been moved into SONOTS Plugin (20070703)

Code: Mahalanobis distance

Table of Contents
Developersonots
First Edition06/2006
Last Modified06/2006
LanguageMatlab

Abstract

This matlab function calculates mahalanobis distance among each vector between two data sets. Mahalanobis distance is a distance measure based on correlations between variables [1].

d(\vec{x},\vec{y})=\sqrt{(\vec{x}-\vec{y})^T\Sigma^{-1} (\vec{x}-\vec{y})},

where \Sigma is the covariance matrix.

Math equation

Refer [1].

Source Codes

Demo

Results

d =

    1.5219    1.9870    1.0235    0.3631    1.4269
    2.1044    2.5058    1.3251    0.5157    1.6762
    0.8648    2.4137    2.0606    1.5932    2.4486
    1.6359    1.3790    2.5120    2.9112    2.5857
    1.0500    1.0308    1.8977    2.2219    2.0397
    1.5470    1.0710    2.2191    2.6570    2.2805
    3.0419    1.4079    1.5431    2.3606    1.1565
    2.7225    1.0694    1.3580    2.1863    1.0113
    2.5706    1.3082    0.8151    1.6082    0.4102

References