dist_chisquared

PURPOSE ^

Calculates the Chi Squared Distance between vectors (usually histograms).

SYNOPSIS ^

function D = dist_chisquared( X, Y )

DESCRIPTION ^

 Calculates the Chi Squared Distance between vectors (usually histograms).

 Assume X is an m-by-p matrix representing m points in p-dimensional space and Y is an
 n-by-p matrix representing another set of points in the same space. This function
 compute the m-by-n distance matrix D where D(i,j) is the chi-squared distance between
 X(i,:) and Y(j,:).  

 The chi-squared distance between two vectors is defined as:
   d(x,y) = sum( (xi-yi)^2 / (xi+yi) ) / 2;
 The chi-squared distance is useful when comparing histograms.

 INPUTS
   X   - m-by-p matrix of m p-bin histograms
   Y   - n-by-p matrix of n p-bin histograms

 OUTPUTS
   D   - m-by-n distance matrix

 EXAMPLE
   X=[randn(100,5)]; Y=randn(40,5)+2;
   D = dist_chisquared( abs([X; Y]), abs([X; Y]) ); im(D)

 DATESTAMP
   29-Sep-2005  2:00pm

 See also DIST_EUCLIDEAN, DIST_EMD

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Wed 03-May-2006 23:48:50 by m2html © 2003