Signal filtering, smoothing and delay
24 views (last 30 days)
Show older comments
Aladin Djuhera
on 12 Oct 2019
Commented: Aladin Djuhera
on 21 Oct 2019
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 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.
Accepted Answer
Daniel M
on 15 Oct 2019
I created a butterworth filter using filterDesigner, with the following parameters: Bandpass, IIR - Butterworth, specify order: 4, Fs = 500, Fc1 = 0.5, Fc2 = 40. Then exported the coefficients:
SOS =
1 0 -1 1 -1.9911 0.99116
1 0 -1 1 -1.3191 0.50059
G =
0.21246
0.21246
1
Then applied it to the mat-file data:
fs = 500;
t = 0:1/fs:(length(y)-1)-1/fs;
y = y_sine_vert;
Y = filtfilt(SOS,G,y);
figure
plot(t,detrend(y),t,Y) % detrend(y) because I used a cutoff freq of 0.5 for Y.
% You can add the DC component back if you wish.
residuals = detrend(y)-Y;
figure
plot(t,detrend(y),t,residuals)
And attached are the results. I think the zoomed in plot wonderfully shows how the underlying sine waves are captured and noise is removed. The earlier parts of the full series have small signal-to-noise ratio, so the results aren't as great. But looking at the residuals, shows that what was removed was essentially noise.
Otherwise, if that isn't sufficient, then I don't know what you really want.
More Answers (1)
Aladin Djuhera
on 13 Oct 2019
2 Comments
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.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!