Digital Signal Processing with Field Programmable Gate Arrays

Chapter04 - Home
Exercises: 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - 11 - 12

Exercise. This is the solution to exercise 4.1 in the book.

Solution. We can design the filter using Matlab’s fdatool. The designed filter has 9 sections and order 18. We can convert the filter to single section and determine filter length and ripple in passband. Use the following code:

 
% butter’, cheby1’, cheby2’, ellip 
filter_type = ellip; 
D = fdesign.lowpass(Fp,Fst,Ap,Ast,400,500,3,48,2000); 
H = design(D, filter_type); 
HS = singlesection(H); 
design(D, filter_type); % shows the filter figure 
filter_coeffs=get(HS,Numerator); 
display([Filter length =  sprintf(%d,length(filter_coeffs))]); 
% get the magnitude frequency response 
h = freqz(filter_coeffs); 
% find the ripples in interval 0..400 Hz with Fs/2=1000 Hz 
magnitude=abs(h(1:floor((400/1000)*length(h)))); 
maxripple=max(abs(magnitude-1)); 
display([Max absolute ripple =  sprintf(%.4f, maxripple)  ( sprintf(%.4f,20*log10(maxripple+1.0))  dB)]);

Type LengthRipple, dB



Butterworth 19 5.985
Chebyshev I 9 5.984
Chebyshev II 9 6.358
Elliptic 6 5.897

The magnitude responses are shown below. For Butterworth filter:


PIC

For Chebyshev I filter:


PIC

For Chebyshev II filter:


PIC

For elliptic filter:


PIC