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:
  1. How do I compare both the signals? Is there anything like Pearson coefficient for these type of signals?
  2. 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

Answers (1)

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 Comments

On plotting both the data together, there is no linear realtionship(see the figure below). That is why I am wondering if I still can apply Pearson.
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).
I understand, but the figure I showed has actually a good estimation of the actual signal and this is not the case everytime. Sometimes, it is really bad and when I plot them together, I see that they are highly non-linear. That is why I was wondering if Pearson still holds.
What do you get for the r value in the "bad" cases? If it's small then it's giving you the right information!
I get lower values for bad cases however, I am worried about the signigicance of the result.
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)')
Sorry, I don't understand what is happening. Only on cumulative areas, you mean only till a certain data point?. Is there a reference/study material for this method as I want to be certain of what method I am using. Thank you.
It's just a suggestion of a way of ranking your different models!

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!