sampling rate and the filter output improvement
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
Sampling rate: I am working with acquiring pusle signals using microcontroller and sending them to the matlab with the serial communication.The plot with red in the attached file is the output signal of matlab for 1 second which is received from the microcontroller and the sampling rate used with the microcontroller for this is the 500Hz for this 1sec of pulse signal. I am confused with the sampling rate to be used for the filtering part in matlab.As the signal has been sampled at a rate of 500Hz at the microcontroller so what sampling should be used if a LPfiltering has to be done in the maltb for this 1sec interval pulse signal as when I used 100Hz it showign the signal adn when 500Hz is used there is no pulse signal.
Improving the fitler response: The signal (th red plot) in attached when analysed in the frequency domain is showing the max freq components below 2Hz So,I used a sampling rate of 100Hz with the following LPfilter
d = fdesign.lowpass('Fp,Fst,Ap,Ast',2,2.2,0.5,40,100);
Hd1 = design(d,'butter');
The filter is removing the unwanted frequency components but the filter output is delayed and also it not showing the remaining samples(it missign around 300 samples). Is there a way of overcoming this problem or is there is something changed needed with the filter design.
댓글 수: 0
채택된 답변
Wayne King
2013년 12월 19일
편집: Wayne King
2013년 12월 19일
You definitely don't want 1.) -- We've talked about the sampling rate.
This looks like a pretty clean signal actually, what are you trying to accomplish?
d = fdesign.lowpass('Fp,Fst,Ap,Ast',5,10,1,40,500);
Hd = design(d);
% your signal is a in the .mat file
y = filtfilt(Hd.Numerator,1,a);
plot(y)
The above looks pretty good to me.
댓글 수: 2
추가 답변 (7개)
kjetil87
2013년 12월 18일
300 samples sounds about correct from fvtool. Try adding a trail of 300 zeros after your signal. Or get the filering method you use to also output the final conditions of the delays (ie Zf if you use filter)
댓글 수: 0
Wayne King
2013년 12월 18일
I'm not quite understanding your post, but you have to use the sampling frequency in fdesign.lowpass().
If the data is sampled at 500 Hz, then you use 500 Hz in your filter design, not 100 Hz.
If you downsampled your data by a factor of five, then you would use 100 Hz.
Wayne King
2013년 12월 18일
편집: Wayne King
2013년 12월 18일
If the data is transmitted to MATLAB in digital form without applying additional sampling operators then the sample rate used in the filter must be 500 Hz.
It is exactly the same as if you read a .wav file into MATLAB. If the .wav file is generated using a sampling rate of Fs, then any filter design you do in MATLAB uses the same sampling rate.
댓글 수: 3
Wayne King
2013년 12월 20일
I'm not sure why you think you need to have such a low cutoff. Based on the data you provided early, 5 Hz seemed to work just fine.
You have to realize you are asking a lot out of a filter -- a stopband frequency only 0.6 Hz higher than the passband frequency --- that is going to be a very long filter - which is why you are getting problems with filtfilt()
You can try an IIR filter to see if that is short enough, but again, I'm not sure why you need to constrain your filter like that.
d = fdesign.lowpass('Fp,Fst,Ap,Ast',2.4,3,1,40,500);
Hd = design(d,'butter');
% just creating some data
x = randn(500,1);
y = filtfilt(Hd.sosMatrix,Hd.ScaleValues,x);
The above will work with only 500 points -- the IIR filter is much shorter.
julyrbc bernaola campos
2014년 4월 28일
hello Gova I wanted to ask if you came out the filter in matlab using a microcontroller for I am also trying to do something but I just can not help poodria some doubts .. thanks
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Single-Rate Filters에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!