I designed a CIC decimation filter, and am trying to plot its frequency response. Given below are the specifications of the filter.
>Sampling Freq fclk: 1.4MHz
>Decimation D: 100
>Input bits: 3
>Output bits: 24
> What is the proper way to plot the magnitude the freq response of the
>I did the following: If I send in 102400 samples into the filter, I get 1024
samples out. In Matlab, I use the sampling frequency flck of 1.4MHz, and perform
the FFT for 1024 points. For plotting, I have 512 (1024 points by 2) frequency
points equally distributed between 0 and fclk/2.
>The problem is that I am not getting the expected response, i.e., my plot is
not showing a zero at fclk/D, and multiples of it. What am I doing wrong?
I can't answer your question but can perhaps shed some light on why
you're not seeing the results you expect.
One way of finding the freqeuncy response of a decimation filter is to use the
freqz function in matlab. If vector b contains the unit impulse response of the
filter, then freqz(b,1) will plot the frequency response. The catch here is that
you have to take the impulse response of the filter before decimation, which
isn't an option with a CIC filter since decimation occurs between the
integrators and combs.
When you look at the output, all the notches get folded back to DC. You could
apply an excitation containing frequencies in the band(s) you are trying to
reject and then look at the FFT of the output. In this way you can infer the
Another thing to watch is that implementations of CIC filters rely on modulo 2
arithmetic where, as long as you have long enough word lengths, overflows in the
integrators get corrected in the combs. For your simulation MATLAB will probably
use fixed point arthmetic unless you are specify otherwise. As the numbers grow
in the integrators, the precision may deteriorate.