<< Chapter < Page | Chapter >> Page > |
Type | ||
---|---|---|
I | ||
II | ||
III | ||
IV |
To analyze or design linear-phase FIR filters, we need to know the characteristics of the amplitude response .
Type | Properties | |
---|---|---|
I | is even about | |
is even about | ||
is periodic with | ||
II | is even about | |
is odd about | ||
is periodic with | ||
III | is odd about | |
is odd about | ||
is periodic with | ||
IV | is odd about | |
is even about | ||
is periodic with |
The frequency response of an FIR filter can be evaluated at equally spaced frequencies between 0 and using the DFT. Consider a causal FIR filter with an impulse response of length- , with . Samples of the frequency response of the filter can be written as Define the -point signal as Then where is the -point DFT of .
Suppose the FIR filter is either a Type I or a Type II FIR filter. Then we have from above or Samples of the real-valued amplitude can be obtained from samples of the function as: Therefore, the samples of the real-valued amplitude function can be obtained by zero-padding , taking the DFT, and multiplying by the complex exponential. This can be written as:
For Type III and Type IV FIR filters, we have or Therefore, samples of the real-valued amplitude can be obtained from samples of the function as: Therefore, the samples of the real-valued amplitude function can be obtained by zero-padding , taking the DFT, and multiplying by the complex exponential.
In this example, the filter is a Type I FIR filter of length 7. An accurate plot of can be obtained with zero padding.
The following Matlab code fragment for the plot of for a Type I FIR filter.
h = [3 4 5 6 5 4 3]/30;N = 7;
M = (N-1)/2;L = 512;
H = fft([h zeros(1,L-N)]);
k = 0:L-1;W = exp(j*2*pi/L);
A = H .* W.^(M*k);A = real(A);
figure(1)w = [0:L-1]*2*pi/(L-1);subplot(2,1,1)
plot(w/pi,abs(H))ylabel('|H(\omega)| = |A(\omega)|')
xlabel('\omega/\pi')subplot(2,1,2)
plot(w/pi,A)ylabel('A(\omega)')
xlabel('\omega/\pi')print -deps type1
The command
A = real(A)
removes the
imaginary part which is equal to zero to within computerprecision. Without this command, Matlab takes
A
to be a complex vector and the
following plot command will not be right.
Observe the symmetry of due to being real-valued. Because of this symmetry, is usually plotted for only.
The following Matlab code fragment produces a plot of for a Type II FIR filter.
h = [3 5 6 7 7 6 5 3]/42;N = 8;
M = (N-1)/2;L = 512;
H = fft([h zeros(1,L-N)]);
k = 0:L-1;W = exp(j*2*pi/L);
A = H .* W.^(M*k);A = real(A);
figure(1)w = [0:L-1]*2*pi/(L-1);subplot(2,1,1)
plot(w/pi,abs(H))ylabel('|H(\omega)| = |A(\omega)|')
xlabel('\omega/\pi')subplot(2,1,2)
plot(w/pi,A)ylabel('A(\omega)')
xlabel('\omega/\pi')print -deps type2
The imaginary part of the amplitude is zero. Notice that . In fact this will always be the case for a Type II FIR filter.
An exercise for the student: Describe how to obtain samples of for Type III and Type IV FIR filters. Modify the Matlab code above for these types. Do you notice that always for special values of ?
Notification Switch
Would you like to follow the 'Intro to digital signal processing' conversation and receive update notifications?