Signal filtering, smoothing and delay
Show older comments
Hi guys !
For further system analysis I have decided to filter some signals, obtained from an acceleration measurement of a dynamic system with multi-sinusoidal excitation signals. I'm kind of desperate to remove the noisy parts and the outliers of the sensors.
The annotated pictures speak more than words. I want to eliminate the noisy trends of the signals, especially in the lower frequency areas where the acceleration sensors' noise is considerably high. Furthermore, I want to eliminate the high outliers represented over the signal.
I have tried the filtfilt function with a butterworth filter and a cut-off frequency at around 40Hz (the excitated signals were at maximum with 20Hz frequency). Though, I have not been successful to remove what I intended to. I have also searched through matlab and tried several sgolay filters, but nothing really led to a satisfying result.
Please find attached the signal plot and the mat file. I hope you guys can help !!!
Full acceleration signal of the vertical multi-sine excitation with maximum sine at the end with frequency f=20Hz.

Outliers at higher frequencies:

Heavy noise at lower frequencies:

14 Comments
Daniel M
on 12 Oct 2019
I have several suggestions, but since I'm not near a computer I can test them myself, which is why I'm not posting in the answer section.
First is you should remove DC effects by detrending (or high pass filter with a cutoff of 0.5 Hz) your data. The reason it hovers at around 10 is because acceleration due to gravity is 9.8. So just center it around zero.
Next thing that strikes me is your sampling rate seems pretty high for a signal with an apparent max of 20 Hz. I think just downsampling your data (or smoothing, moving average, low pass filtering, etc) would help.
Next, I would suggest trying median filtering, or mean filtering the data. 2-3 standard deviations should do it, but play with it. You could try a sliding window (see rmoutliers), or you could consider epoching your data (because of the slowly increasing amplitudes) and applying the filter to each epoch.
What does an fft of this data look like? I get the feeling the noise is much higher than 40 Hz and you can raise your cutoff frequency.
Aladin Djuhera
on 12 Oct 2019
Daniel M
on 12 Oct 2019
Of course it's possible. What is the sampling rate of the accelerometer? Have you looked at the fft?
Aladin Djuhera
on 12 Oct 2019
You're doing great so far, follow the example on how to produce the single sided amplitude spectrum.
And 500 Hz sampling rate isn't bad, so probably don't need to down sample. But there's other time-domain smoothing to try. But the frequency domain filter will be more powerful. Use fvtool to look at what your filter is doing.
Aladin Djuhera
on 13 Oct 2019
Daniel M
on 13 Oct 2019
It's hard to see because of the large spike at zero (because of the DC offset), so try semilogy.
Aladin Djuhera
on 13 Oct 2019
Image Analyst
on 13 Oct 2019
Please show what you think noise free signals would look like.
Aladin Djuhera
on 13 Oct 2019
Daniel M
on 13 Oct 2019
And what does a lowpass filter (cutoff 50 Hz) look like? Zoom in on just one of the high amplitude bursts.
Aladin Djuhera
on 13 Oct 2019
Daniel M
on 13 Oct 2019
That seemed to help. Now try downsampling.
y = downsample(x,n);
And play with different values of n from 2-10. Again, I could be of more help, but am only on mobile.
Aladin Djuhera
on 14 Oct 2019
Accepted Answer
More Answers (1)
Aladin Djuhera
on 13 Oct 2019
0 votes
2 Comments
Aladin Djuhera
on 13 Oct 2019
Daniel M
on 15 Oct 2019
This code is hard to use because it is not standalone. Make it easy for people to help you by uploading an m-file that runs without error. Otherwise, the code seems likely to be error-prone. Just use movmedian if you want to do something like this.
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!







