How to campare signals with different length?
7 views (last 30 days)
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!
Star Strider on 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.
More Answers (1)
Jan on 27 Apr 2022
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.