# Difference between reference and measurement signal?

Which differences can we find on various signals? We assume that we have a reference signal (determined theoretically) and measured signal. Which methods exist for determining the similarities between them? The signals have no phase shift. If I calculate the cross correlation between the signals, I get max value of cross correlation result (graph) on a 0. I conclude from this that there is no phase shift between them.

An example of the signals is in attached figure. Blue line is reference, red line is measurement signal.

One way to look at it is to just find the difference (error):

$$e[n] = y_{\tt ref}[n] - y_{\tt meas}[n]$$

where $$y_{\tt ref}$$ is the reference signal and $$y_{\tt meas}$$ is the measured signal. Then one can look at this error signal, $$e$$, as an innovation process.

If the innovation process is "white" (noise), then all the information in the measured signal is in the reference. If the innovation process is not white, then there is some predictable part of the error that the reference signal is not taking account of.

This predictable part might be a gain or a delay, or it might be some more complex filtering. You can use something like this to determine whiteness or otherwise.

I assume you want to get a measure of "similarity" of the signal, in order to get a score of similarity between the measure and the reference.

For measurements where there is no phase shift is not uncommon to use RMSE, MSE or MAE.

MAE is the simplest of them all called "Mean Absolute Error":

$$MAE = \frac{\displaystyle\sum_{i=0}^n \left| y_{\tt ref}[n] - y_{\tt meas}[n]\right|}{n}$$

MSE and RMSE are: "Mean Square Error" and "Root Mean Square error":

$$MSE = \frac{\displaystyle\sum_{i=0}^n (y_{\tt ref}[n] - y_{\tt meas}[n])^2 }{n}$$

$$RMSE = \sqrt{\frac{\displaystyle\sum_{i=0}^n (y_{\tt ref}[n] - y_{\tt meas}[n])^2 }{n}}$$

$$RMSE = \sqrt{ MSE }$$

This measurements are an indicator of how off is your measurement from the theoretic value in average. And they work well as long as there is not phase shift. For example in image restoration this measurements are used to validate denoising algorithms, where the place of the pixel is fixed (meaning the phase is not shifted).

This error measurements are commonly used as a loss function in neural networks also. Maybe you can look an example of some of them here.

Last but not least: if you had phase shift, you should be looking for other methods, for example using the DTW(Dynamic Time Warping) distance, or more "distance along curves measuring methods" like Hausdorff distance or Fréchet distance.