Correlation between two signals
Mostra commenti meno recenti
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
Risposte (1)
Alan Stevens
il 10 Ott 2020
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 Commenti
Praveen Kumar Pakkirisamy
il 10 Ott 2020
Alan Stevens
il 10 Ott 2020
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
il 10 Ott 2020
Alan Stevens
il 10 Ott 2020
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
il 11 Ott 2020
Alan Stevens
il 11 Ott 2020
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
il 15 Ott 2020
Alan Stevens
il 15 Ott 2020
It's just a suggestion of a way of ranking your different models!
Categorie
Scopri di più su Correlation and Convolution in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!