Filtering a very noisy signal
49 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone
I´m trying to filter a very noisy signal.
My problem is I need some help because I don´t know how to do it.
My signal looks like this

As anyone can see this is very noisy. I want to filter this signal so that I can get a signal that follows the top values. To understand it better this I am measuring the temperature on a conveyor belt which transports something (which corresponds to the lower temperatures). I am interested just in the temperatures of the C.Belt...
I want that my signal should look like this.

can someone help me? This is my data in a matfile Thanks in advance
2 件のコメント
採用された回答
Birdman
2018 年 4 月 4 日
Try the following code. Fistly, by the help of psd function, I observed your data's frequency plot to see at what frequencies you have noise, then in second part, by using butterworth function, I designed a filter to smooth your data. Hope this helps. Note that fc cut off frequency and order of filter should be chosen wisely.
load('oven.mat');
A=meas.Temp;
t=meas.Time;
Fs=1000;
h1=spectrum.welch;
set(h1,'Windowname','Hann');
set(h1,'OverlapPercent',66.7);
set(h1,'SegmentLength',1024);
myPsd=psd(h1,A,'Fs',Fs);
figure(1);
semilogx(myPsd.Frequencies/(2*pi),myPsd.Data);
set(gca,'XLim',[3 100]);
%it is seen that your data contains noise higher than 50Hz
fc=30;%cutoff frequency(Hz)
fs=1000;%sampling frequency(assumed)
[b,a] = butter(5,fc/(fs/2),'low');
y=filter(b,a,A);
figure(2);
plot(t,A);hold on;plot(t,y);legend('original','filtered');
hold off;
2 件のコメント
Birdman
2018 年 4 月 4 日
Jose's answer moved here:
Hi again. This seems to work. But to use your code I need to understand it very well... Thanks for you help. Now... can you please explain what is done? what do you mean by "it is seen that your data contains noise higher than 50Hz" how can you see that?
Birdman
2018 年 4 月 4 日
When you check the first figure, which is plotted by semilogx command, you will see that at higher frequencies(if you zoom on them), you will see some movements. This means that you have noises at those frequencies. If you want to get rid of them, you need to use a filter. The unit of them are Hertz.
butterworth command just uses cutoff and sampling frequencies to design the necessary filter of an order that you specify. It has the following transfer function:
Wn^2
________
(s+Wn)^2
If you plot the Bode of it, you will see the magnitude will start to decay after the cutoff frequency, which is given by us.
その他の回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Fixed-Point Filters についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!