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!