How to campare signals with different length?

26 visualizzazioni (ultimi 30 giorni)
Hi
Can someone help me out please? If I have a set of signals with different length. How can I compare them with the reference one and get the similarity or kind of correlation.
For example I have a reference signal with 75 samples. 10 signals with different length between 65 to 80. I would like to use those 10 signals to compare with the reference one by one and see how similar they are.
I know the correlation if I have the signals with the same length but I am confusing about how to do it with the different length signals. I have a roughly idea is make those 10 signals shifting from left to right of reference signal but I dont know which output should I do to compare the similarity.
Thanks for your help!
Best Regards

Risposta accettata

Star Strider
Star Strider il 27 Apr 2022
One option may be the Signal Processing Toolbox findsignal function (introduced in R2016b). The signal lengths are not important.
The function also produces a third output that is the Euclidean distance between the two signals, so that will be a measure of their similarity.
  4 Commenti
BoWen Han
BoWen Han il 2 Mag 2022
Thanks for your help! I will look into it. Thanks for all your suggest xd

Accedi per commentare.

Più risposte (1)

Jan
Jan il 27 Apr 2022
It depends.
You can compare two sine waves, if one has 80 and the other one 75 samples. But how do you define "similarity"? You can shift the phase, interpolate to change the frequency, shift the signal up and down and amplify the values until the curves are matching. But are they more similar, if you have to adjust only the phase or only the amplitude?
How similar are two sin waves, if the second one equals the first one plus some noise?
Before you can implement this in Matlab, you have to define mathematically (or even better physically), what you want to compare. Otherwise the results are arbitrary:
What is the difference between a blackbird? - Both legs have the same length, especially the right one.
  1 Commento
BoWen Han
BoWen Han il 2 Mag 2022
Thanks for your help and sorry for late reply. Yeah this is the point I am struggling how to define the 'similarity'. I have some results now but it is hard to say how the result can present similarity.
Thank you

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by