# Implementing a very sharp IIR (125Hz sampling rate, 0.2Hz bandwidth)

I am trying to design a IIR lowpass filter. The purpose of this filter is to get pure DC from noises.

1. The sampling rate is: 125Hz.
2. The bandwidth of the filter: 0.2Hz.

I designed the filter with Matlab:

[b,a] = ellip(3,0.001,60,0.001);
freqz(b,a);
figure(2)
out = filter(b,a,ones(1,2000));
plot(out)


The frequency response: at 0.3Hz is -20dB, which is good for me.

The step response:

The coefficients:

a = [1.000000000000000 -2.984668175804313 2.969460975930567 -0.984792292477895];

b = 1.0e-04 *[0.750233362790290 -0.747695120994728 -0.747695120994729 0.750233362790290];

My questions

1. From the step response, it seems that the 452th data is close to 1. Can I say that I have to wait for 451 data to get a desired DC value? By desired, I do not care much about the gain ripple on DC, meaning that it is fine for me if DC has a small gain(0.9-1.1) on it.

2. The filter coefficients seem to be pretty small, especially the b part. Can I implement the filter successfully on a Cortex-M4, which is a 32 bit MCU with FPU?

• That is a lot of decimal places... – Tyler Mar 24 '16 at 14:16
• There are float types supported in Cortex-M4. Even double, I think. – richieqianle Mar 24 '16 at 14:17
• How would you know the start time to wait, if this is all realtime? If you want to extract noise from system, there is no such time period that you can know "a priori", like from now and after x-samples I get the real value. – Marko Buršič Mar 24 '16 at 15:19
• @MarkoBuršič great question! Because I will record the response of the system after a known stimulus. The stimulus is generated by me at a specific known time. – richieqianle Mar 24 '16 at 15:21