how to find correlation coefficient?

조회 수: 5 (최근 30일)
Anusha
Anusha 2014년 3월 18일
답변: Jos (10584) 2014년 3월 18일
a=[ 1 3 4 5 6 7;4 5 6 7 2 1;2 3 4 5 6 7;]
now the a will be rearranged
b=[1 2 4 6 7 5;2 7 6 4 1 5;7 5 3 4 2 1]
how to find correlation coefficient and plot?
  댓글 수: 3
Anusha
Anusha 2014년 3월 18일
plot the graph for correlation coefficient
Patrik Ek
Patrik Ek 2014년 3월 18일
편집: Patrik Ek 2014년 3월 18일
Plot the graph of a number? I cannot see what you are talking about. The correlation coefficient of a two matrices are defiend as above
corrcoef = [autoCorrA,xCorrAB;xCorrBA,autoCorrB];
where every element is a number. Do you mean that you what the cross correlation sequence ( xcorr ), or do you even want the cross correlation matrix? These are not the same as the correlation coefficient. Also do you want help of finding out how to plot something and which functions to use to plot, like plot, plot3, surf, ..., or do you want help to calculate whatever you tries to plot? This needs to be clarified since more people will look at this later on and I need to be sure of what I answer.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jos (10584)
Jos (10584) 2014년 3월 18일
a = a(:) % transform into vectors
b = b(:)
plot(a, b, 'b.')
xlabel('Value of a') ;
ylabel('Value of b') ;
lsline % LS regression line
[r,p] = corrcoef(a,b) ;
r = r(1,2)
p = p(1,2)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by