Correlation between two signals
이전 댓글 표시
The figure below shows the plot of two different signals which I am aiming to compare. The blue signal is the actual signal and the red signal is the prediction of the same signal. I have also attached signals a and b as mat files.

I have following questions:
- How do I compare both the signals? Is there anything like Pearson coefficient for these type of signals?
- I believe that applying Pearson coefficient for this signal is not right as the two signals are quite non-linear (I observed this by scatter-plotting both together).
Thank you in advance. Stay safe and healthy
답변 (1개)
Alan Stevens
2020년 10월 10일
I don't see why you shouldn't use a Pearson r correlation:
A = a - mean(a);
B = b - mean(b);
r = A*B'/ (norm(A)*norm(B));
댓글 수: 8
Praveen Kumar Pakkirisamy
2020년 10월 10일
Alan Stevens
2020년 10월 10일
I guess it's not a perfect measure here, as you could get r = 1 if the two curves were each asymmetrical but perfect horizontal reflections of each other, for example.
However, if the prediction is a small(ish) perturbation about the actual, Pearson probably serves as a reasonable measure in choosing between different sets of model parameters (or model structures).
Praveen Kumar Pakkirisamy
2020년 10월 10일
Alan Stevens
2020년 10월 10일
What do you get for the r value in the "bad" cases? If it's small then it's giving you the right information!
Praveen Kumar Pakkirisamy
2020년 10월 11일
Alan Stevens
2020년 10월 11일
How about using the correlation coefficient on the cumulative areas:
load('a.mat')
load('b.mat')
a1 = cumsum(a);
b1 = cumsum(b);
A = a1-mean(a1);
B = b1-mean(b1);
r = A*B'/(norm(A)*norm(B));
x = 1:numel(a);
disp('Correlation coefficient')
disp(r)
subplot(2,1,1)
plot(a1,b1,'o'),grid
title('cumsum(A) vs cumsum(B)')
subplot(2,1,2)
plot(x,a1,'b',x,b1,'r'),grid
legend('cumsum(a)','cumsum(b)')

Praveen Kumar Pakkirisamy
2020년 10월 15일
Alan Stevens
2020년 10월 15일
It's just a suggestion of a way of ranking your different models!
카테고리
도움말 센터 및 File Exchange에서 Correlation and Convolution에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!