|
Anna <annek@ifm.liu.se> wrote in message <3613025.4494.1240294862489.JavaMail.jakarta@nitrogen.mathforum.org>...
> Is there a command in MatLab to calculate the normalized euclidean distance between to series x and y? What I want to do is:
> (((x1-y1)/x1)^2+((x2-y2)/x2)^2+((xn-yn)/xn)^2)^0.5
>
> Thanks!
Anna, I think you really want this:
(((x1-y1)/s1)^2+((x2-y2)/s2)^2+((xn-yn)/sn)^2)^0.5
where s1, s2, and s3 are the standard deviations in the three respective x1, x2, x3 coordinates over a given sample set. This is the normalized euclidean distance from a point [y1,y2,y3] to a point [x1,x2,x3] of the sample set. It assumes that the covariance matrix is diagonal.
The closest I can come to in matlab functions for this is 'mahal' in the statistics toolbox which calculates the Mahalanobis distance, a more general form than the normalized euclidean distance which makes no such assumption as above. See the Wikipedia web site at:
http://en.wikipedia.org/wiki/Mahalanobis_distance
Roger Stafford
|