PDA

View Full Version : corr2.m in MATLAB and Octave



sammy0131
August 22nd, 2010, 06:54 AM
Hi, I'm trying hard to migrate on Ubuntu and started changing the scripts that i wrote for MATLAB to those for Octave.

I found that I've got a different result when I'm running "corr2" function in MATLAB and
Octave.

I use the same size of two matrices and then used as:

R = corr2(matrixA, matrixB);

in MATLAB R is one correlation coefficient just as:
http://www.mathworks.com/access/helpdesk/help/toolbox/images/corr2.html.

However, when I run the same script in Octave, the answer turns out to be a
matrix. For example is I used 5000x600 matrix, the R is 600x600.

I'd very much appreciate if anyone can explain to me why this is happening.

Thanks in advance,

carandraug
August 30th, 2010, 12:25 AM
This was solved in the octave-dev mailing list (http://www.mail-archive.com/octave-dev@lists.sourceforge.net/msg04320.html).


I guess that to replicate Matlab

you need to call corr2(a(:),b(:))

as for cov
http://octave.sourceforge.net/nan/function/cov.html