%-------------Begin Lab #5--- %********************** % Colin D. Joye * % Lab #5 * % ECE 3220 - 001 * % Due Tue. 11/28/00 * %********************** % Objective and Conclusions: % The purpose of this practicum was to design % various filters and see the relation of the % pole / zero positions and how they affect the % filters. clear; % 2.a) N = 6; % N is the order of the filter. w0 = 120*pi; % w0 is the cutoff frequency (rad/sec) [z,p,k]=cheb2ap(N, 40); % z: vector of zeros. % p: vector of poles. % k: gain constant. num = k*poly(z); den = poly(p); [num,den] = lp2lp(num,den,w0); z = roots(num); p = roots(den); pang = -angle(p); pamp = abs(p); zang = -angle(z); zamp = abs(z); figure(1) polar(zang, zamp, 'b*'); hold on; polar(pang, pamp, 'rd'); hold off; text(1,2,'2, Colin D. Joye'); title('Chebychev LP: Plot of poles (diamond) and zeros (*)'); [res,pol,dr]=residue(num',den'); wdel = 10; w = [10:wdel:100000]; hfreq1 = freqs(num,den,w); mag1 = abs(hfreq1); phase1 = angle(hfreq1)*180/pi; figure(2) subplot(211); semilogx(w,phase1); grid; text(1000,150,'2, Colin D. Joye'); xlabel('log w'); ylabel('angle(H(jw))'); title('Chebychev LP: Plot of phase response vs. frequency'); figure(2) subplot(212); semilogx(w,20*log10(mag1)); grid; text(1000,-15,'2, Colin D. Joye'); xlabel('log w'); ylabel('|H(jw)|'); title('Chebychev LP: Plot of magnitude vs. frequency'); %See attached sheet for impulse response. abs(res) angle(res) % 3) % The location of the first zero (at ~390 hz) on the plot of the % poles and zeros in the s-plane is very close to the break % point for the Chebychev filter of 120pi= ~377 hz. The second % zero (533 hz) in the pole-zero plot, is the second dip in the % magnitude vs frequency plot. The third zero at 1456 hz coresponds % to the third (and largest) dip in the magnitude plot. The zeros % also corespond to the abrupt phase shifts in the phase response % plot. The poles in the pole-zero plot corespond to peaks in the % magnitude plot. %-------------End Lab #5---