EE422G Homework #1 (12 poits) 1. (5 poits) I this problem, you are asked to explore a importat applicatio of FFT: efficiet computatio of covolutio. The impulse respose of a system is give by h(t) (.9),1,2,,1 ad the iput to the system is give by x(t) si(¼π,1,2,,1 You are asked to use the fft ad ifft commads i Matlab to compute ad plot the output y(t) h(t) * x(t). >> :1; >> h.9.^; >> x *si(1/4*pi*; >> H fft(h,6); % fft pads zero >> X fft(x,6); >> Y X.*H; >> y ifft(y); >> plot(:62,y,'r',:1,x,'b',:1,h,'g') 6 y x h 4 2-2 -4 1 2 4 5 6 7 I additio, please aswer the followig questios: a. hat is the miimum value of N i the N-poit DFT (FFT) eeded to compute this liear covolutio? N must be large eough so that it exceeds the legth of the output sequece, which is the sum of the legths of the iput ad impulse sequece mius oe, or 6.
b. If the impulse respose has N o-zero samples ad the iput has M o-zero samples, how may arithmetic operatios (additios ad multiplicatios) are eeded to compute the liear operatio from its defiitio, i.e. y( T ) N 1 m h( mt ) x( T mt ) for,1,..., M 1? Each sample i the output sequece requires at most 2 max(n,m) arithmetic operatios the max operator is eeded as less operatios are eeded i the begiig ad at the ed samples as the amout of overlap betwee the iput ad the impulse respose is smaller. Sice there are N+M-1 o-zero output samples, the total umber of operatio is roughly 2 max(n,m) (N+M-1). I the case whe NM ad they are sigificatly bigger tha 1, the above expressio ca be simplified as roughly equal to 4N 2. c. Repeat b) but usig the FFT method. If FFT is used, both the iput sequece ad the impulse respose eed to first zero-padded to N+M-1. This process does ot use ay arithmetic operatios (except perhaps oe to compute what N+M-1 is). The the two forward FFT costs about 2(N+M-1)log(N+M-1) operatios. The frequecy samples are the multiplied with each other ad this takes N+M-1 operatios. The fial iverse FFT takes (N+M-1)log(N+M-1), makig the total cout of operatios (N+M- 1)[log(N+M-1)+1]. For large NM, we have roughly 6N logn. As oe ca see this is sigificatly faster tha the straightforward liear covolutio. 2. (4 poits) Durig lecture, we discussed the decimatio-i-time method of implemetig FFT i which we partitio the sequece ito eve ad odd time samples. There is a alterative approach called decimatio-i-frequecy which we are goig to explore i this problem. Recall that a -poit DFT is give by j2π where N exp. N a. Show that It is easy to see that X ( k) 7 k 4k [ x( + + ] ( + 4) k [ x( + + ] 7 x( X ( k) x( T ),1,...,7 k [ x( + ( 1) ] X ( k) + 4k k ( 1) (2), thus the right had side of (2) becomes b. For eve k, show that equatio (2) is equivalet to the 4-poit DFT of the sequece y ( x( + + 2k For eve k, we have 4 Usig (2) ad the give substitutio, we have (1)
X (2k) y( 4 2k [ x( + ( 1) + ] Y ( k) c. For odd k, show that equatio (2) is equivalet to the 4-poit DFT of the sequece y( [ x( + + ] There is a typo i this questio so everyoe is gettig full credit for this part: ( x( + 2k The substitutio should be y [ ] (2k + 1) X (2k + 1) [ x( + ] 2k [ x( + ] y( 4 Y ( k) d. Draw the butterfly etwork of the -poit DFT i terms of the preprocessig stage followed by two 4-poit DFTs.. (4 poits) Filter desig a. Respose of the aalog filter i. ii. iii. b. For the low pass filter i part a), desig a digital filter H(z) with Ts1 msec usig the followig techiques:
i) Impulse Ivariat Desig ii) Step Ivariat Desig: iii) Biliear Trasformatio: c) Matlab Code to obtai the plots:» T.1;» w1/t*[1 zeros(1,1];» w1/t*[1 zeros(1,1)];» w_impulse1/t*[1 zeros(1,1)];» w_stepoes(1,11);» t[:t:1];» w_expoetialexp(-4*t);» um_impulse5*t;» de_impulse[1 -exp(-.4)];» um_step5/4*(1-exp(-.4))*[ 1];
» de_step[1 -exp(-.4)];» um_biliear5/24*[1 1];» de_biliear[1-196/24];» y_impulse_impulsefilter(um_impulse,de_impulse,w_impulse);» y_impulse_stepfilter(um_impulse,de_impulse,w_step);» y_impulse_expoetialfilter(um_impulse,de_impulse,w_expoetial);» y_step_impulsefilter(um_step,de_step,w_impulse);» y_step_stepfilter(um_step,de_step,w_step);» y_step_expoetialfilter(um_step,de_step,w_expoetial);» y_biliear_impulsefilter(um_biliear,de_biliear,w_impulse);» y_biliear_stepfilter(um_biliear,de_biliear,w_step);» y_biliear_expoetialfilter(um_biliear,de_biliear,w_expoetial);» y_aalog_impulse5*exp(-4*t);» y_aalog_step5/4*(1-exp(-4*t));» y_aalog_expoetial5*t.*(exp(-4*t));» plot(t,y_impulse_impulse,'o',t,y_step_impulse,'*',t, y_biliear_impulse,'x',t,y_aalog_impulse)» grid,title('ee422 - Respose of digital ad aalog filters to impulse')» plot(t,y_impulse_step,'o',t,y_step_step,'*',t,y_biliear_step,'x', t,y_aalog_step)» grid,title('ee422 - Respose of digital ad aalog filters to step')» plot(t,y_impulse_expoetial,'o',t,y_step_expoetial,'*', t,y_biliear_expoetial,'x',t,y_aalog_expoetial)» grid,title('ee422 - Respose of digital ad aalog filters to exp(- 4t)')
As expected, the impulse ivariat desig respose agrees exactly with the aalog filter whe the iput is a impulse ad similarly, the step ivariat desig respose agrees exactly with the aalog filter whe the iput is a step. The biliear trasformatio does well whe the aalog respose is relatively smooth.
1 4. ( poits) Desig a digital filter for the aalog prototype H ( s) usig ( s + 5)( s + 1) both the impulse-ivariat ad the biliear methods. The sample period of the digital filter is.1 secod. Plot the amplitude ad phase resposes of the aalog filter as well as the two digital filters ad commet o their differeces. >> um 1; >> de cov([1 5],[1 1]); >> freq 1/.1; >> [bz,az] impivar(um,de,freq); >> [bz1,az1] biliear(um,de,freq); % Biliear mappig >> [ha,w] freqs(um,de; >> hd freqz(bz,az,w/(2*pi),freq); >> hd1 freqz(bz1,az1,w/(2*pi),freq); >> subplot(1,2,1); plot(w,abs(ha),'b',w,abs(hd),'r',w,abs(hd1),'g'); >> subplot(1,2,2); plot(w,phase(ha),'b',w,phase(hd),'r',w,phase(hd1),'g'); >> subplot(1,2,1); title('magitude'); xlabel('freq(rad/s)'); >> subplot(1,2,2); title('phase'); xlabel('freq(rad/s)');.2 Magitude Phase Biliear clearly has o aliasig (almost zero at the half samplig freq)..1.16.14.12.1..6.4.2 aliasig -1-2 - -4-5 -6-7 - -9 5 1 Freq( rad/s) -1 5 1 Freq(rad/s)