# Are there algorithms to compare changes in signal amplitudes?

I am working on a project to reduce resonances caused by motors. The vibrations in the material are measured and sampled by ADCs. The measuring works as intended and the next step is to reduce the measured resonances. My problem is the comparison of different measurements of the same resonances. I have an example: The first picture shows the whole measurement with different uncompensated resonances. The second picture shows an uncompensated resonance and the third picture the same resonance but with compensation (samples from 15.3k to 16.3k). I need some metric or algorithm to be able to detect that the compensated resonance is "better" than the uncompensated one. Better in this context means that the amplitudes are smaller and less vibration is caused.

Initially, I thought of taking the absolute signal values and calculating the average amplitude like this:

$$\overline{A} = \sum \frac{\left|f(x)\right|}{N_{f(x)}},$$ where $$f(x)$$ are the samples and $$N_{f(x)}$$ is the number of samples.

After searching for algorithms on the internet I thought that my approach might be too simple and there are probably established algorithms in digital signal processing for such purposes. The closest fit I could find was cross-correlation to measure similarities between signals. I think this might not work for my problem, since cross-correlation does not describe in which direction the signals differ and I need to select which signal has overall lower amplitudes.

I also took a look at the resonance in the frequency domain. The compensation influenced primarily the amplitudes, so there was no significant change in the frequency domain. Here is a picture of my test:

The picture shows the above mentioned resonance both compensated and uncompensated in the time domain on the left and their FFT on the right. This was done in Scilabs.

I found many algorithms for different aspects of signal processing but nothing that addresses my problem. Is my initial idea a good way to compare the signals or are there better algorithms for comparing changes in signal amplitudes?

Update

I am not sure whether it is better to update or answer comments separately, but I have chosen to update the question because I got another graphic.

First of all, I looked at The Wavelet Tutorial, which was recommended in another post by OverLordGoldDragon, who commented on this question with a link to the other question. The wavelet transformation or time-frequency-analysis in general seems really interesting, but I do not think it helps with my problem. The resonances caused in my application are stationary signals, so FFT should be just fine to analyze the spectrum. However, my main concern is reducing the amplitudes of the resonances and find a way to compare them. There should be no need to compare the spectrum at different times. If I misunderstood something, please correct me.

Max commented that my FFT resolution was too low, which was true and I can present an example of another resonance (samples 2k to 3k), with 50 times as many samples.

This is a way better picture of the spectrum and shows, that two frequencies (290Hz and 390Hz) have been eliminated from the signal. What surprised me was the change in amplitude of the 100 Hz frequency. In the time domain the signals amplitude reduced by roughly 5.4% while the amplitude in the frequency domain reduced by roughly 40%. I can not explain where that difference comes from.

• Your FFT-resolution seems to be very low. Increase it at least by factor 10 and you will see the distinct peak caused by the resonance. You should then be able to see the difference in the height of the peaks when comparing uncompensated/compensated.
– Max
Oct 12, 2022 at 12:06
• Oct 12, 2022 at 15:31
• What did you exactly do to compensate the resonance? Whatever it was, it probably can be hold responsible for reducing the amplitude. You can see the time signal after compensation has a lower amplitude.
– Max
Oct 13, 2022 at 11:44
• The compensation was developed by somebody else. My goal is to automate the compensation procedure. I test different inputs for the compensation (three integers with ranges from 0-128) and then measure the resonances. Reducing the amplitude is a good thing, exactly what I want. But I need to compare many iterations of the process (change input, measure again) and pick the one with the overall lowest amplitudes i.e. smallest resonance. Oct 13, 2022 at 11:50
• Re-reading, TFA is indeed overkill, but your heuristic has the right idea, a form of moving average. This appears to be a control systems problem, so the "right" measure depends on the specific method used. Oct 13, 2022 at 21:23