Fatias7
Fatias7

Reputation: 101

Cross-Correlation and Interpolation to choose the most similar signal

I am using Matlab to perform some signal processing and I have a question about cross-correlation and interpolation to choose the most similar signal.

Let's say I have two signals K1 and K2, with sampling frequency 30Hz, and a third signal Q, with sampling frequency 100Hz. The first step I perform is spline interpolation on the signals K1 and K2 in order to have a sampling frequency of 100Hz. Then, I perform an amplitude normalization on all signals so they can be comparable.

So for now, I have three signals with sampling frequency 100Hz and all of them have different lengths. Now my main question: in the end I want to choose which signal, K1 or K2, is more similar with Q and I want them to have the same length. I thought on two hypothesis:

1 - I interpolate the three signals to the same length and then I perform cross-correlation and choose the signal with maximum value of cross-correlation

2 - I perform cross-correlation, choose the signal with maximum value of cross-correlation and then I interpolate the two signals (the Q and the signal chosen)

My doubt here is that on the first option, when I interpolate the three signals then I will perform cross-correlation with signals with different sampling frequencies but the same length. On the second option, I am performing cross-correlation with signals with the same sampling frequency but different length and then I interpolate.
I am not sure which is the correct way of doing this or even if it is indifferent.

I am using the functions spline and ppval for the interpolation and the function xcorr for the cross-correlation.

Upvotes: 0

Views: 1519

Answers (1)

xvan
xvan

Reputation: 4855

1) Spline might not be a good enough upsampling interpolator. It's pretty for printing and lightweight to compute, but doesn't minimise distortion. Better use http://www.mathworks.com/help/signal/ref/intfilt.html

2) Cross correlation must be done with signals of the same sampling frequency.

3) For cross-correlation you don't need signals of the same length, if Q is shorter than Kn, the correlation coefficients are of windows of Kn, with the size of Q.

Upvotes: 2

Related Questions