Signal filtering, smoothing and delay

21 views (last 30 days)
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.
sine_vertical_full.jpg
Outliers at higher frequencies:
outliers.jpg
Heavy noise at lower frequencies:
low_frequency_noise.jpg
  14 Comments
Daniel M
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
Aladin Djuhera on 14 Oct 2019
Sadly does not help and downsampling is really a hard manipulation of data, isn't it ? I wouldn't go higher than factor 3.
However, this does not help. Can u look at the code i posted down here ?

Sign in to comment.

Accepted Answer

Daniel M
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.
  1 Comment
Aladin Djuhera
Aladin Djuhera on 21 Oct 2019
Thank You Very Much!
I have obtained good results with that signal :)
Thanks for your help, patience and matlab know-how !

Sign in to comment.

More Answers (1)

Aladin Djuhera
Aladin Djuhera on 13 Oct 2019
I received good results using the following code from: https://stackoverflow.com/questions/42944461/removing-spikes-from-a-signal-matlab
Code:
%moving cleaning window
y1_1= y1(1:100);%first window
x=1;
%cleaning loop
while x<= length(y1)
if(y1(x)> 1.01*(median(y1_1))||y1(x) < 0.95*(median(y1_1)))
y1(x)= median(y1_1);
end
if(x>= length(y1)-100)
y1_1= y1(length(y1)-100:length(y1));
else
y1_1 = y1(x:x+100);
end
x=x+1;
end
I obtained the following result, which I am very satisfied with:
good.jpg
But on the other hand, the signal amplitudes are damped quite heavily after the first third of the signal. I would like that damped part to be not manipulated that heavily but instead to apply to the same results obtained in the first third.
shit.jpg
Thank you guys !
  2 Comments
Aladin Djuhera
Aladin Djuhera on 13 Oct 2019
Up to 2.125 on the x axis, the signal is just as I want it to be. Then it gets manipulated strongly. How can I avoid this? What did I understand wrong in the code ?
Daniel M
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.

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!