The following Matlab code fragment illustrates how to use this
approach to design a length 11 Type I FIR filter for which
∀k,(0≤k≤N−1)∧(N=11):A2πNk=11100000011T
k
0
k
N
1
N
11
A
2
N
k
1
1
1
0
0
0
0
0
0
1
1
.
>> N = 11;
>> M = (N-1)/2;
>> Ak = [1 1 1 0 0 0 0 0 0 1 1}; % samples of A(w)
>> k = 0:N-1;
>> W = exp(j*2*pi/N);
>> h = ifft(Ak.*W.^(-M*k));
>> h'
ans =
0.0694 - 0.0000i
-0.0540 - 0.0000i
-0.1094 + 0.0000i
0.0474 + 0.0000i
0.3194 + 0.0000i
0.4545 + 0.0000i
0.3194 + 0.0000i
0.0474 + 0.0000i
-0.1094 + 0.0000i
-0.0540 - 0.0000i
0.0694 - 0.0000i
Observe that the filter coefficients h
are real and symmetric; that a Type I filter is obtained as
desired. The plot of
Aω
A
ω
for this filter illustrates the interpolation
points.
L = 512;
H = fft([h zeros(1,L-N)]);
W = exp(j*2*pi/L);
k = 0:L-1;
A = H .* W.^(M*k);
A = real(A);
w = k*2*pi/L;
plot(w/pi,A,2*[0:N-1]/N,Ak,'o')
xlabel('\omega/\pi')
title('A(\omega)')
An exercise for the student: develop this DFT-based
interpolation approach for Type II, III, and IV FIR filters.
Modify the Matlab code above for each case.