I am new on digital filter, hopefully I can get some intuitive insights here. So, here is the question:

A low pass filter with 5Hz cut-off frequency is to be designed. The signals presented have maximum frequency of 1kHz. Therefore a 1MHz sampling rate will fully satisfy the Naquist Sampling theory for the digital filter part.

**Analog Filter:**

Say I want to implement a 5Hz analog low pass filter, I need to wait at least 0.2s, or even 10 times more time, to get one accurate data, because of the charging time of RC circuits.

**Digital Filter:**

Are things the same for digital filters?

Say I want to implement a 10 tap(data length) low pass filter with cut off frequency 5Hz. The sampling rate is 1MHz. Can I get a valid data within 1/(1MHz/10) = 10us time? That seems not very reasonable to me….

**Comments Needed:**

In this application, two filters are to be designed.

In both filters, we only want to know the DC. The DC signal is buried in large noises. A cutoff frequency of 5Hz is chosen, since we want to have valid readings at 5Hz. And lower cutoff frequency means smaller noises, but also longer time needed to get an appropriate reading.

One filter has bandwidth of 6kHz(not 1MHz, which was just an example). And we are planning to over sample it with sampling rate of 36kHz. The other one filter has bandwidth of 60Hz, and we are planning to over sample it at 1kHz.

As can be observed from the filter description, we want lower noises, as low as possible. Therefore the digital filters are expected to have sharp edge at 5Hz. And all other parameters, such as "linear phase, small ripple.. and etc" are not important to us, since we only care about DC readings.

And, I am quite confused by the enormous types of digital filters.. How to choose them? Say, between FIR and IIR?

## Best Answer

There is great flexibility in the design of a digital filter. You can design digital filters that behave very similarly to analogue filters (as Andy aka described). You can also build digital filters than can be hard to reproduce in analogue such as a Linear phase filter or a Half-Band filter. Or non-linear digital filters such as Median filters that have no analogue equivalence in LTI systems.

For your requirements of "a sharp, low pass filter" I'd suggest a simple IIR of the form:

out = (1-a)

in + aoutthe closer 'a' is to 1 the lower the cutoff frequency of your filter.

You may well have a problem with the 1MHz sample rate and 5Hz cutoff because: a = exp(-2*pi*f/fs) where f is the cutoff frequency and fs is the sample frequency. So for your example:

a= exp(-2*pi*5/1E6) = 0.99997

If you really do need a 1MHz sample rate (because your data must be sampled by a 1MSPS ADC for example), then a 3 stage multi-rate filter is more appropriate. For this you would:

UPDATE BASED ON NEW INFO FROM OP: Based on your information that:

I think your best choice is a CIC Decimator.

Basically, its an MA (FIR) digital filter, made up of

a differentiator at the output clocked at the output rate.

You can control how much filtering you get by changing the output rate.

For example with an input rate of 36kHz and an output rate of 5Hz this gives you a 36000/5 = 7200 point moving average. In reality you'd like to keep the rates as binary ratios so M=13 gives 36kHz in 36kHz/2^13 out and MA length is 2^M = 8192

The group delay of this will be 2^(M-1)/Fin or 113ms for the above example. That's one of the disadvantages of such a simple circuit but would not be a problem in a system whose DC value varies slowly.