I already used an FIR lowpass fitler as shown below with a fc=4Hz and sampling freq=100Hz for the data attached
Code:
Hf = fdesign.lowpass('N,Fc',31,4,100);
Hd =design (Hf);
Coeff= Hd.Numerator;
data3= filtfilt(Hd.Numerator,1,a);
But, I now I want to design the IIR fitler for the same to check the difference between the both implementation with the microcontroller.
can someone help with the better lowpass IIR filter design in matlab for the input pulse signal (data attached) if the needed fc=4Hz and sampling freq=100Hz.
Read the Matlab help aboit IIR design methods. fdesign.lowpass('N,Fc',...) is only valid for FIR.
Apart from this point I don't agree with your assumption about "better lowpass IIR filter". FIR is basically good, although order of 31 is insufficient for a good lowpass filter with fc/fs = 4/100.
I guess you misunderstood me.
Sorry, its my fault for not explaining this clearly "design the IIR fitler for the same".
I mean I want use the same data for designing the IIR filter but not the same method of FIR.
1)you said"although order of 31 is insufficient for a good lowpass filter with fc/fs = 4/100."
Waht is the formual used to calculate the best or sufficient order for requirements.
2)can I get some help with the IIR filter design implementation like with selection of type(chebyshev type I or type II or butterworth or any other method) and order to be used for my requirement.
Thanks.
FvM : Thanks and you said "although order of 31 is insufficient for a good lowpass filter with fc/fs = 4/100."
can I know how to get (or know) the best or sufficient order for requirements.