Signal filtering, smoothing and delay
조회 수: 8 (최근 30일)
이전 댓글 표시
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242356/sine_vertical_full.jpeg)
Outliers at higher frequencies:
![outliers.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242357/outliers.jpeg)
Heavy noise at lower frequencies:
![low_frequency_noise.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/242358/low_frequency_noise.jpeg)
댓글 수: 14
Daniel M
2019년 10월 13일
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.
채택된 답변
Daniel M
2019년 10월 15일
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개)
Aladin Djuhera
2019년 10월 13일
댓글 수: 2
Daniel M
2019년 10월 15일
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.
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Analysis에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!