Frage

consider the following graphs:

enter image description here

All graphs represent measurements of a surface, but taken in different directions.

I would like to compute how much the blue graph(s) are shifted to the right compared to the red graph(s). Is there a built-in function in MATLAB to achieve this? If not, how else could one approximate the "phase" shift?

War es hilfreich?

Lösung

You can use xcorr for a quick and dirty solution, presuming that the shifts are not too large and the sampling is equal:

[c lags] = xcorr(red,blue); 

c is the actual correlations. lags is the shifts made to the blue input before correlating it with red.

Therefore, lags(c==max(c)) should tell you how much to shift blue to get the best match with red.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top