I am trying to measure the similarity between two signals, i.e. how identical they are. A complete overlap (two lines forming a single line) should give me a value of 1, the greater the distance, between the lines and the less similar the overall trend, the closer the value should go to 0.
I have tried measuring standard deviation $\sigma$ and different variants of correlation $r$ using MATLAB functions std()
, xcorr()
and corr2()
. They did not do the trick, as ,e.g. $\sigma_{\phi_{A}}$ was $>$ than $\sigma_{\phi_{B}}$ (see figure below).
I was thinking about using some sort of weighted average between $\sigma$ and $r$. Another possibility would be to measure the difference between areas under the curves (but then different intersecting graphs could have the same area).
There are related questions to this, but they are either: (i) discussing the generic concept of similarity or (ii) suggest using xcorr()
(different variants of which did not work for me).