# How to detect overall error between two signals and also track changes occurred

I need to develop an algorithm that will compare two signals (1 Reference Signal and other is measured signal values from sensor) and generate some metric(s) to describe changes between them. I am not good at signal processing and analysis so I would appreciate any help.

I have attached figures below to provide an idea about how my both signals looks like.

Some of the differences that I am expecting are:

1 -Amount of error between Reference signal and measured values signal.(I want to calculate value of overall error or difference occurred).

2- Changes that occurred in measured signal from reference signal like Amplitude change in some parts, phase changes, offset occurred, Difference in Peaks and troughs, rise and fall transitions.

(In short I want to have an overall idea about all the changes that happened in measured signal in comparison from reference signal). My signal is too complex and has lot of values so I remained unable to develop an approach for it from my side.

The algorithm needs to output some generic metrics which can be used to quantify changes in any or all of these parameters. Any guidance on what method(s) I could use to do this would be a great help.

For the case of finding errors I have think of RMSE is it a good idea to take this approach as the length of my signals are same. Given the data reference signal and sensor signal data of size 1x1626100 and 1 x 1626100 double.

Correlation function also came into my mind but according to my knowledge I can only find similarity between different signals using correlation function not the total error or overall changes that occurred in signal.

The signal is generated provides an information about changes in steering angle along with time.

Various measurements are taken over time at the same location and the final objective is to determine how the signals have changed over time (due to physical/Hardware changes).

We have taken different tests to find out how physical/Hardware changes affect my signal values and in every test speed, velocity or brakes condition of cars are different. I also needs to take into account these things for my algorithm.

The measurement system may indeed be moving at different speeds, and may have different acceleration profiles during the measurement. This needs to be accounted for in my algorithm.

I am performing this algorithm development in Matlab.

Detailed Description :

I am working on steering wheel angle sensor that measures absolute angle of steering wheel. As steering angle sensors uses gears and several joints which is totally hardware related so in spite of calibration in start with the passage of time due to usage of mechanical parts and also due to some environmental and road conditions some errors occurs in the values of sensors (e.g. offset, phase change, flattening of signal).

In short due to these errors in the measurements our aim gets distracted means If I am viewing velocity vs time curve so if in the original or calibrated sensor in short close to ideal condition sensor my velocity shows a peak in amplitude but due to error (hysteresis) in measured signal I am not getting peak in velocity curve or I am getting flattening of curve so it will affect my final task.

I have a tolerance let say 1.20 degree for hysteresis so that’s why I am having detailed idea about my signal and want to observe my signal if some changes means offset, delay, lowering has occurred in my signal or not. This will not only provide me an idea that whether to lessen the amount of sensors used for my task or made some changes in hardware of sensor to lessen the amount of hysteresis or do some other actions to reduce it.

What I have done uptill now in which uptill now I am not sure that whether I am right or wrong. I am getting some values for hysteresis but I am also not satisfied with the values and the technique used. If someone provides me an idea about it how to improve these techniques or provide me a better approach then it will be nice and great guidance.

I have an ideal sensor signal (under ideal conditions which we want) and values from 1 sensor I have data of 6 different drives from car. I am explaining just 1 example of my first drive and its relation with my reference sensor data.

Given the data reference signal and sensor signal data of size 1x1626100 and 1 x 1626100 double for one reading from sensor but in all readings values from Ideal and measured signal w.r.t to time are same.

1- I have applied Gaussian Technique to estimate error in my data but I am not satisfied with it as I am not getting some good values or expected values with it may be due to outliers or some other errors.

I have subtracted (Ref – measured value of signal). Calculated mean of difference signal, Standard Deviation of difference signal, then make a Gaussian Curve along with mean and standard deviation. Made 2 lines one for mean+ standard deviation and 2nd one is with Mean – Standard Deviation and distance between +ve Mean_std and –ve Mead_std is called Hysteresis (Loss). Please see figure 1 and 2 for this.

2- In this method I have applied Regression Technique.

I took difference of my signals (Ref – measured value of signal).

Applied regression technique above and below the difference signal means on upper values and on lower values separately and difference between upper and lower values regression lines is called as Hysteresis (Loss). Please have a look at figure 3 and 4 for clear view.

3- I have not tried to applied these techniques just have studied about these but understanding is not too clear.

Can I apply RMSE for this case and what are the limitations to use RMSE technique and also can I consider Ideal Reference signal as my model signal for RMSE technique application.

4- Can I use correlation (Cross correlation) Function for completion of my task and if yes then how because I have heard that it will only work best when I have to just find the similarity between my signal.

5- That’s the reason I want to find a matrix to find the values of offset, lowering, delay in my signal but as my signal is bit complicated so it’s not easy to visualize it normally so just asking for some way to solve this issue.

6- Also which method will work best in my case and why.**

I hope that I remained able to provide you the clear idea and detailed review what I want to do and what I am expecting and I hope to get some positive and valuable response from people. Thanks for cooperation in advance.

• What is it that you are trying to understand from your signal? "Change in signal" is too generic, talk about your application and what problem you are trying to resolve – Pier-Yves Lessard Jul 16 '17 at 15:38
• Thanks a lot Pier-Yves Lessard for your reply. Actually I want to analyse the data of steering angle w.r.t time means how much our steering of car changes w.r.t time. First I want to find overall loss between 2 signals. (Reference and measured signal). 2nd I am interested in Amplitude, offset ,phase and frequency changes that occurred in measured signal. – john Jul 16 '17 at 15:59
• On the basis of these points I will get an estimate that how to nullify this effect through hardware as the change is coming either due to hardware or environmental or physical issues but for that First I have to find out how much change occurs and in which aspects of signals change occurred. I hope I remained able enough to provide u a mature answer uptill ur expectations. – john Jul 16 '17 at 15:59
• In simple words I need to find out error between 2 signals and 2nd question is regarding if there is some change that occurred in measured signal values then how to track it in terms of amplitude ,phase, frequency ,flattening of signal and offset. – john Jul 16 '17 at 16:03
• Is it possible for me to solve my first question regarding error by applying RMSE in matlab by considering Reference signal as model and comparing measured signal values with it. – john Jul 16 '17 at 16:18