# Decimation filter: Output magnitude response

Started by July 1, 2010
```I have a decimation filter which decimates by 100.

Input sampling frequency fclk1 = 1.6MHz,
Output Sampling freq flck2 = 16kHz.

I am trying to plot the input and output frequency responses.

For the input, I use fft function in matlab, and get the magnitudes of my
frequency response. To generate the plot X-axis points (i.e., frequencies)
I do the following

freq = (flck1/fftPtsIn)*(1:1:fftPtsIn/2) (assume fftPtsIn/2 gives an
integer)

fftPtsIn is the number of input sample points used in the FFT.

For output plot, to generate the X-axis points

freq = (flck2/fftPtsOut)*(1:1:fftPtsOut/2) (assume fftPtsOut/2 gives an
integer).

fftPtsOut is the number of input sample points used in the FFT.

The problem is that the frequency scale for the output plot only extends
to (fclk2)/2. How will I show that all frequency tones higher than
(fclk2)/2 are being filtered?

```
```>I have a decimation filter which decimates by 100.
>
>Input sampling frequency fclk1 = 1.6MHz,
>Output Sampling freq flck2 = 16kHz.
>
>
>I am trying to plot the input and output frequency responses.
>
>For the input, I use fft function in matlab, and get the magnitudes of my
>frequency response. To generate the plot X-axis points (i.e.,
frequencies)
>I do the following
>
>freq = (flck1/fftPtsIn)*(1:1:fftPtsIn/2) (assume fftPtsIn/2 gives an
>integer)
>
>fftPtsIn is the number of input sample points used in the FFT.
>
>
>For output plot, to generate the X-axis points
>
>freq = (flck2/fftPtsOut)*(1:1:fftPtsOut/2) (assume fftPtsOut/2 gives an
>integer).
>
>fftPtsOut is the number of input sample points used in the FFT.
>
>The problem is that the frequency scale for the output plot only extends
>to (fclk2)/2. How will I show that all frequency tones higher than
>(fclk2)/2 are being filtered?
>

Typo, fftPtsOut is the number of output sample points
```
```analog_fever <usu_vlsi@n_o_s_p_a_m.yahoo.com> wrote:

>I have a decimation filter which decimates by 100.

>Input sampling frequency fclk1 = 1.6MHz,
>Output Sampling freq flck2 = 16kHz.

>For the input, I use fft function in matlab, and get the magnitudes of my
>frequency response.

Any reason you are not using freqz?  (Assuming you want to use
an off-the-shelf matlab command.)

>The problem is that the frequency scale for the output plot only extends
>to (fclk2)/2. How will I show that all frequency tones higher than
>(fclk2)/2 are being filtered?

You need to implement your filter at 16 MHz input and 16 MHz output
sample rates, without decimation, then look at its output spectrum.
You will not obtain the information you are asking for if you look
only at the decimated signal.

Your system may not require you to implement the un-decimated
filter; but you need to look at it as part of your analysis.

Hope this helps.

Steve
```
```>analog_fever <usu_vlsi@n_o_s_p_a_m.yahoo.com> wrote:
>
>>I have a decimation filter which decimates by 100.
>
>>Input sampling frequency fclk1 = 1.6MHz,
>>Output Sampling freq flck2 = 16kHz.
>
>>For the input, I use fft function in matlab, and get the magnitudes of
my
>>frequency response.
>
>Any reason you are not using freqz?  (Assuming you want to use
>an off-the-shelf matlab command.)
>
>>The problem is that the frequency scale for the output plot only extends

>>to (fclk2)/2. How will I show that all frequency tones higher than
>>(fclk2)/2 are being filtered?
>
>You need to implement your filter at 16 MHz input and 16 MHz output
>sample rates, without decimation, then look at its output spectrum.
>You will not obtain the information you are asking for if you look
>only at the decimated signal.
>
>Your system may not require you to implement the un-decimated
>filter; but you need to look at it as part of your analysis.
>
>Hope this helps.
>
>Steve

Steve,

Thanks for the response. You mean, I have to set my decimation rate to 1,
and see the filter output response? But, will the filter frequency response
be different for decimated, and undecimated outputs?
```
```>>analog_fever <usu_vlsi@n_o_s_p_a_m.yahoo.com> wrote:
>>
>>>I have a decimation filter which decimates by 100.
>>
>>>Input sampling frequency fclk1 = 1.6MHz,
>>>Output Sampling freq flck2 = 16kHz.
>>
>>>For the input, I use fft function in matlab, and get the magnitudes of
>my
>>>frequency response.
>>
>>Any reason you are not using freqz?  (Assuming you want to use
>>an off-the-shelf matlab command.)
>>
>>>The problem is that the frequency scale for the output plot only
extends
>
>>>to (fclk2)/2. How will I show that all frequency tones higher than
>>>(fclk2)/2 are being filtered?
>>
>>You need to implement your filter at 16 MHz input and 16 MHz output
>>sample rates, without decimation, then look at its output spectrum.
>>You will not obtain the information you are asking for if you look
>>only at the decimated signal.
>>
>>Your system may not require you to implement the un-decimated
>>filter; but you need to look at it as part of your analysis.
>>
>>Hope this helps.
>>
>>Steve
>
>
>Steve,
>
>Thanks for the response. You mean, I have to set my decimation rate to 1,
>and see the filter output response? But, will the filter frequency
response
>be different for decimated, and undecimated outputs?
>

bump
```