How do I get one correlation coefficient of R value in MatLab?
30 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all am new to matlab, so this maybe a very stupid question to some..
When I use excel to calculate the correlation i get one R value. How do I do this in MatLab? I am using the code below R=(corrcoef(xdata,ydata)); xdata is a 5 by 1 and ydata is also 5 by 1 am getting the result below 1.0000 0.5356
0.5356 1.0000
not sure what this results means ones on the diagonal, as I only want a single value of R..
Can someone please explain to me what am doing wrong or how can I get a single R value.
0 Commenti
Risposte (1)
Star Strider
il 22 Lug 2012
Not stupid at all. The values are the correlations of the various columns (by number) with each other. The ones on the diagonal are the correlations of each variable with itself. So in your [2 x 2] situation, where the function is treating ‘xdata’ as one column and ‘ydata’ as the other, the values you want are R(2,1) or R(1,2). (The matrix is symmetric.)
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!