*This preview shows
pages
1–4. Sign up
to
view the full content.*

This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*This
** preview**
has intentionally

**sections.**

*blurred***to view the full version.**

*Sign up*
**Unformatted text preview: **UNIVERSITY OF ILLINOIS AT URBANA-CHAMPAIGN Department of Electrical and Computer Engineering ECE 410 Digital Signal Processing Homework 12 Solutions Wednesday, November 12, 2008 Prof. Bresler, Prof. Jones Due by November 19, 2008 Problem 1 (20 points) Design a length-7, symmetric ramp FIR filter h [ n ] ,n = 0 , 1 ,..., 6 with desired frequency re- sponse D ( ) = | | (before the linear phase shift) by hand. Use the window design method with a simple truncation ( i.e. , rectangular/boxcar) window and give the filter coefficients as your answer. Using Matlab, plot separately the magnitude and phase of H ( ), using at least 1000 points between- and . Also plot the ideal desired magnitude response | D ( ) | on the same plot as the actual response. Solution: Introducing the required linear phase-shift, the desired frequency response is G d ( ) = | | e- j 3 and the ideal (IIR) filter coefficients are its inverse DTFT, i.e. , g [ n ] = 1 2 Z - | | e- j 3 e jn d = 1 2 - Z- e j ( n- 3) d + Z- e j ( n- 3) d = 1 2 Z e- j ( n- 3) d + Z- e j ( n- 3) d = 1 Z cos( n- 3) d = ( n- 3) sin( n- 3) fl fl fl + 1 ( n- 3) 2 cos( n- 3) fl fl fl , n 6 = 3 2 , n = 3 = ( 1 ( n- 3) 2 [cos( n- 3) - 1] , n 6 = 3 2 , n = 3 = ( 1 ( n- 3) 2 (- 1) n- 3- 1 / , n 6 = 3 2 , n = 3 With a length 7 rectangular window, h [ n ] = 1 ( n- 3) 2 (- 1) n- 3- 1 / , n 6 , n 6 = 3 2 , n = 3 , otherwise 1 The magnitude and phase response for the ideal and FIR filter are computed in Matlab using the following code and shown in figure 1. % Problem 1 N = 7; M = (N-1)/2; n = 0:(N-1); h = zeros(1,N); fftlen = 1024; w =[-fftlen/2: fftlen/2-1]/fftlen*2*pi; % Filter coefficients for G_d(w) = |w|, using rectangular window h = 1./(pi*(n-3).^2).*( (-1).^(n-3) -1); h(4) = pi/2; % Estimated filter response H = fftshift(fft(h,fftlen)); mag = abs(H); ang = angle(H); % Ideal (desired) filter response mag_g = abs(w); ang_g = angle(exp(-j*3*w)); figure(1); plot(w, mag, w, mag_g,r:, LineWidth, 2); title(Magnitude Responses); xlabel(\omega (radian)); legend(|H_d(\omega)|, |G_d(\omega)|,-1); xlim([-pi pi]); ylim([0 pi]); grid on print -depsc P1_mag figure(2); plot(w, ang, w, ang_g,r:, LineWidth, 2); title(Phase Responses); xlabel(\omega (radian)); legend(\angle H_d(\omega), \angle G_d(\omega), -1); xlim([-pi pi]); ylim([-pi pi]); grid on print -depsc P1_phase 2 Problem 2 (20 points) Use the frequency sampling method respectively to design a length-101 type-1 GLP FIR high- pass filter having cutoff frequency c = 3 / 4 and generalized linear phase....

View
Full
Document