0
$\begingroup$

I want to determine the frequency response of a filter bank from the input x[n] to the four output channels.

$H_0$ is an lowpass and $H_1$ is a highpass filter. Both are FIR filters and I have the numerator coefficients of them, they have an order of 50.

My attempt in matlab would be to use the downsample command on the filter coefficients and multiply them element-wise and pass the result to the freqz command.

So from $x[n]$ to $x_4[n]$ I'd do it the following way: freqz(downsample(num_h0, 2) .* downsample(num_h0, 2) .* downsample(num_h0, 2));

Is this the right way or am I missing some point here?

Also how do I plot all four frequency responses in one plot, respectively how do I have to scale the frequency axis? Is it right to say that the sample rate of $x_4[n]$ is $\frac{1}{8}$ of the inputs sample rate.

Filter Bank

$\endgroup$
1
$\begingroup$

You mix up the convolution theorem: You cannot multiply the impulse responses, but merely their spectra, if you want to go this way.

However, a simpler way (esp. when you have Matlab available and look for a numeric solution) is to calculate the overall impulse response. For example, considering the filter $x[n] \rightarrow x_1[n]$ you have:

Let $x[n]=\delta[n]$. Then, $x_1[n]=h_1[2n]$, i.e. the impulse response of the overall filter is $h_1[2n]$. Note, that n is zero-based here (i.e. first sample is at $n=0$).

You can also do this in Matlab. Generate a delta impulse and send it through the filter bank. The resulting impulse responses are your effective FIR coefficients for each filter path:

N = 50;
h0 = ones(N, 1).*exp(-(1:N)');            % a lowpass
h1 = sin(3*(1:N)).*exp(-0.3*(1:N));     % a highpass

x = [1; zeros(1,1)];  % a delta impulse

x1 = downsample(conv(x, h1), 2);

x2p = downsample(conv(x, h0), 2);
x2 = downsample(conv(x2p, h1), 2);

x3p = downsample(conv(x2p, h0), 2);
x3 = downsample(conv(x3p, h1), 2);

x4p = downsample(conv(x3p, h0), 2);
x4 = x4p;


% x4 contains the impulse response of the filter x->x4
f = 1/pi*linspace(-pi, pi, 1000);
f1 = 1/pi*linspace(-pi/2, pi/2, 1000);
f2 = 1/pi*linspace(-pi/4, pi/4, 1000);
f3 = 1/pi*linspace(-pi/8, pi/8, 1000);
f4 = 1/pi*linspace(-pi/8, pi/8, 1000);

subplot(2,1,1);
plot(f, mag2db(fftshift(abs(fft([h0, h1'], 1000, 1)), 1)));
xlim([0, 1]);
xlabel('f/pi');

subplot(2,1,2);
hold off;
plot(f1, mag2db(fftshift(abs(fft(x1, 1000)))));
hold on;
plot(f2, mag2db(fftshift(abs(fft(x2, 1000)))), 'r');
plot(f3, mag2db(fftshift(abs(fft(x3, 1000)))), 'k');
plot(f4, mag2db(fftshift(abs(fft(x4, 1000)))), 'g');
hold off;
grid on;
xlabel('f/pi');
xlim([0, 1]);

Program output

As you see that the sample rate is reduced for each path, the maximum frequency is also reduced by half. If you were to plot all frequency responses over the full frequency range, you'd need to periodically repeat them.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.