sampling rate and the filter output improvement
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Gova ReDDy
el 18 de Dic. de 2013
Respondida: julyrbc bernaola campos
el 28 de Abr. de 2014
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 comentarios
Respuesta aceptada
Wayne King
el 19 de Dic. de 2013
Editada: Wayne King
el 19 de Dic. de 2013
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 comentarios
Wayne King
el 19 de Dic. de 2013
the above filter is FIR. It is an FIR equiripple filter. Did you mean IIR?
Más respuestas (7)
kjetil87
el 18 de Dic. de 2013
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 comentarios
Wayne King
el 18 de Dic. de 2013
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
el 18 de Dic. de 2013
Editada: Wayne King
el 18 de Dic. de 2013
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 comentarios
Wayne King
el 20 de Dic. de 2013
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.
1 comentario
julyrbc bernaola campos
el 28 de Abr. de 2014
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 comentarios
Ver también
Categorías
Más información sobre Single-Rate Filters en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!