MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Sample Correlation Distance Implementation 

Subject: Sample Correlation Distance Implementation From: Ahmad Ammari Date: 31 Mar, 2009 12:53:01 Message: 1 of 3 
I am trying to implement a function that computes the sample correlation distance between column vectors given as a matrix (pos). The function is supposed to return a distance matrix that shows the distances between every column vector pair in the matrix. I got the equation of the sample correlation distance from the statistics toolbox. You can take a look at it in the definition of the pdist function in the Matlab help. 
Subject: Sample Correlation Distance Implementation From: Roger Stafford Date: 2 Apr, 2009 00:36:01 Message: 2 of 3 
"Ahmad Ammari" <ammari@acm.org> wrote in message <gqt3nd$64k$1@fred.mathworks.com>... 
Subject: Sample Correlation Distance Implementation From: Ahmad Ammari Date: 8 Apr, 2009 11:22:01 Message: 3 of 3 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message > Your 'calc_distance' function appears to be designed to accept two row vector inputs. With two column vectors for v1 and v2 the quantity "v1diff*v2difftr" would give you a square matrix, not a scalar. When you attempt to find its square root it is not surprising that this matrix is found to be singular; in fact it is so singular it would have a rank of only one! You need to have "v2difftr*v1diff" instead if you are going to use column vector inputs. 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.