MATLAB: Shape similarity between two signals

MATLABsignal similarity

How can I compare the shape similarity of two signals? corrcoef does not work, because two signals having exactly the same shape of different length tend to have a small coefficient.

Best Answer

If the signals have different time bases, you'll have to align them first, then use corrcoef. To do that you could use either set operations, like intersect, or interpolation of some kind, in which case use interp1. Something like this:
ti = linspace(tmin,tmax,npts);
y1i = interp1(t1,y1,ti,'cubic');
y2i = interp1(t2,y2,ti,'cubic');
corrcoef(y1i,y2i);
Related Question