필터 지우기
필터 지우기

How do I get one correlation coefficient of R value in MatLab?

조회 수: 20 (최근 30일)
yasmin
yasmin 2012년 7월 22일
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.

답변 (1개)

Star Strider
Star Strider 2012년 7월 22일
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.)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by