# Decimator Image Response

Note: this is an improved version of a post I made to the dsp forum a few weeks ago.

This article presents a way to compute and plot the image response of a decimator. I’m defining the image response as the *unwanted* spectrum of the impulse response after downsampling, relative to the desired passband response.

Consider a decimate-by-4 filter with fs= 4 Hz, to which we apply the signal spectrum shown in Figure 1. The desired signal is the CW component at 0.22 Hz, and there is an undesired noise signal from 0.5 to 2 Hz. In a receiver application, the undesired signal might be digitally modulated adjacent channels, which are noise-like. Given the decimation filter response shown, the spectrum at the output after downsampling by 4 is shown in at the bottom of Figure 1. Here, the noise attenuated by the filter’s stopband has aliased into the desired band. This noise is due to the image response of the decimator.

**Figure 1. Decimate by 4 Filter Behavior**.

Top: Example signal with fs = 4

Middle: Decimate-by-4 filter frequency response

Bottom: Spectrum at output of decimation filter after downsampling by 4.

Figure 2 is a block diagram of the decimator with an impulse input. As mentioned, the the image response is the *unwanted* impulse response spectrum after downsampling, relative to the desired passband response. However, we cannot see the unwanted spectrum because it is beneath the desired response. To see the image response, we need to remove the impulse energy below fs_out/2 = 0.5 Hz.

Figure 3 shows a test source for obtaining the image response. The idea is to apply a flat test spectrum over the frequency f_{s_out}/2 to f_{s}/2 (0.5 to 2 Hz). Since such an input has no energy between f = 0 to f_{s_out}/2, the resulting spectrum of the output will be the image response. The test spectrum is obtained by using a brick-wall hpf with corner frequency f_{s_out}/2. The HPF stopband must not contribute to the image response, thus its stopband attenuation must be much higher than the stopband attenutation of the decimation filter.

**Figure 2. Decimate-by-4 Filter with coefficients b.**

**Figure 3. Test source to obtain the image response of the Decimate-by-4 filter b.**

Here is the Matlab code to plot the decimator image response. The coefficients of the example decimation filter are as follows (zeros have been added on the ends to make the impulse response symmetrical after downsampling).

b= [1 0 -3 -6 -7 0 15 27 25 0 -45 -80 -74 0 144 315 456 512 456 315 144 0 … -74 -80 -45 0 25 27 15 0 -7 -6 -3 0 1]/2048;

Compute the frequency response at the input sample rate f_{s} (See figure 4, Top).

fs = 4; % input sample rate [h,f]= freqz(b,1,512,fs); % frequency response of lpf at fs H= 20*log10(abs(h));

Create a brick-wall HPF with corner frequency = f_{s_out}/2 = 0.5 Hz (See Figure 4, Middle).

f = [0 .45 .55 2]; % Hz stopband and passband frequencies for fs = 4 f = f/2; % frequencies relative to fs/2 a = [0 0 1 1]; % stopband and passband response goals b_hp = firpm(180,f,a); % calculate hp filter coeffs N= 180 [h,f]= freqz(b_hp,1,1024,fs); % hpf frequency response at fs H= 20*log10(abs(h));

Find the impulse response of the cascade of the HPF and the decimation filter, then downsample. Find the frequency response of the downsampled impulse response.

u = conv(b,b_hp); % impulse response at lpf output u_down = u(1:4:end)*4; % downsample [h,f]= freqz(u_down,1,512,fs/4); %freq response at fs/4 after downsampling H2= 20*log10(abs(h));

The image response is plotted at the bottom of Figure 4 and also in Figure 5.

**Figure 4. **Top: Response of decimation LPF with f_{s} = 4 Hz

Middle: Response of brick-wall hpf with corner freq = f_{s_out}/2 = 0.5 Hz

Bottom: Decimator image response, f_{s_out} = f_{s}/4.

**Figure 5. Decimator image response, f**_{s_out} = f_{s}/4.

% decimator_plot1.m 4/2/16 nr % plot images for decimate-by-4 % 1. Find response from 0 to fs in usual way. % 2. Create a brick-wall hpf with fc = fs/8. The spectrum of the % impulse response of this filter is in the image band. % 3. Convolve hpf with the decimator coeffs and downsample to get % impulse response. Take freqz of the impulse response to find % the image spectrum. fs = 4; % input sample rate % 1. decimate-by-4 lpf b= [1 0 -3 -6 -7 0 15 27 25 0 -45 -80 -74 0 144 315 456 512 456 315 144 0 … -74 -80 -45 0 25 27 15 0 -7 -6 -3 0 1]/2048; [h,f]= freqz(b,1,512,fs); % frequency response of lpf at fs H= 20*log10(abs(h)); subplot(211),plot(f,H),grid axis([0 fs/2 -100 5]) xlabel('Hz'),ylabel('dB') b_down= 4*b(1:4:end); % impulse response after downsampling [h,f]= freqz(b_down,1,512,fs/4); %freq response at fs/4 after downsampling H1 = 20*log10(abs(h)); % 2. Brick-wall HPF to create filtered impulse at input f = [0 .45 .55 2]; % Hz stopband and passband frequencies for fs = 4 f = f/2; % frequencies relative to fs/2 a = [0 0 1 1]; % stopband and passband response goals b_hp = firpm(180,f,a); % calculate hp filter coeffs [h,f]= freqz(b_hp,1,1024,fs); % hpf frequency response at fs H= 20*log10(abs(h)); subplot(212),plot(f,H),grid axis([0 fs/2 -100 5]) xlabel('Hz'),ylabel('dB'),figure % 3. impulse response with hpf u = conv(b,b_hp); % impulse response at lpf output u_down = u(1:4:end)*4; % downsample [h,f]= freqz(u_down,1,512,fs/4); %freq response at fs/4 after downsampling H2= 20*log10(abs(h)); plot(f,H1,f,H2,'r'),grid axis([0 fs/8 -100 5]) xlabel('Hz'),ylabel('dB')

5/24/16 Neil Robertson

**Previous post by Neil Robertson:**

Peak to Average Power Ratio and CCDF

**Next post by Neil Robertson:**

Digital PLL's -- Part 1

## Comments:

- Comments
- Write a Comment Select to add a comment

If I understood you, essentially what you are trying to do is filter off any unwanted power in the output after decimation. You don't need two filters but your brick wall filter can do both and will reduce resource. Such filter will cut off as you like then follow it by direct decimation (in fact you don't need to compute outputs that are going to be discarded, this is the basis of resource reduction that I mentioned)

Kaz

Actually, the goal is to remove the impulse spectrum in the passband **before** decimation. Resources are not an issue because the HPF is not part of the decimator; it is only used to analyze the decimator performance.

That would be a worthy topic -- but as a retired person, it's not something I'm likely to research. Sorry!

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.

Registering will allow you to participate to the forums on ALL the related sites and give you access to all pdf downloads.