Matlab: correlation number

I have 2 vectors of numbers from 1 or -1. What are the standard Matlab tools that will help me calculate the correlation number between two vectors? Thanks in advance!

+4
source share
2 answers

The CORRCOEF function is what you are looking for:

R = corrcoef(vector1(:),vector2(:)); %# Returns a 2-by-2 matrix of %# correlation coefficients 

If you have a Statistics Tool , you can also check the CORR function:

 RHO = corr(vector1(:),vector2(:)); %# Returns the linear correlation coefficient %# (default is a Pearson correlation) 
+2
source

The corr function in matlab will switch to the Phi coefficient if it sees binary data.

+3
source

All Articles