EE 301 Lab 2 Convoluion 1 Inroducion In his lab we will gain some more experience wih he convoluion inegral and creae a scrip ha shows he graphical mehod of convoluion. 2 Wha you will learn This lab will focus on using MATLAB o graphically porray convoluion. You will hen verify he effec of pulse widh spreading and oupu inerference. In he second par of his lab you will calculae he impulse response of an RC circui. You will hen compare your resuls wih an in-lab exercise. 3 Background Informaion and Noes None. 4 Guided Exercises a. Convoluion: Reproduce he following m-file scrip and run he program. %% Scrip M-file graphically demonsraes he convoluion process %% By B. P. Lahi, Linear Sysems and Signals, page 232, ex M2.4 %% Creae figure window and make visible on screen figure(1) x = inline('1.5*sin(pi*).*(>=0 & <1)'); h = inline('1.5*(>=0 & <1.5)-(>=2 & <2.5)'); dau = 0.005; au = -1:dau:4; i = 0; vec = -1:0.1:4; %% Pre-allocae memory y = NaN*zeros(1,lengh(vec)); for = vec %% Time index i = i+1; xh = x(-au).*h(au); lxh = lengh(xh); %% rapezoidal approximaion of inegral y(i) = sum(xh.*dau); subplo(2,1,1), plo(au,h(au), 'r-', au, x(-au), 'b--',,0,'ok'); 1
EE 301 Lab 2 Coninuous-ime convoluion axis([au(1) au(end) -2.0 2.5]); %% pach command is used o creae he gray-shaded area of convoluion pach([au(1:end-1); au(1:end-1); au(2:end); au(2:end)],... [zeros(1,lxh-1); xh(1:end-1); xh(2:end); zeros(1,lxh-1)],... [0.8 0.8 0.8], 'edgecolor','none'); xlabel('\au'); legend('h(\au)', 'x(-\au)','','h(\au)x(-\au)',3); c = ge(gca, 'children'); se(gca,'children', [c(2);c(3);c(4);c(1)]); subplo(2,1,2), plo(vec,y,'k',vec(i),y(i),'ok'); xlabel(''); ylabel('y()'); ile('y() = \in h(\au)x(-\au) d\au'); axis([au(1) au(end) -1.0 2.0]); grid; %% drawnow command updaes graphics windoe for each loop ieraion drawnow; %% Using he pause command allows one o manually sep hrough he %% convoluion process % pause; end Q 1. Exercising graphical convoluion: A he end of he program, ake a screen sho and include his in your lab repor. Q 2. Comparing wih HW2 Prob4: Modify he program o graphically show your resul of EE301 HW2 Problem 4. Provide wo versions; one wih he appropriae pulse spacing and one wihou he appropriae pulse spacing. You may jus use wo pulses insead of a rain of pulses and you may modify he locaion of he pulses. b. RC circui The RC circui shown below is an example of an LTI sysem. The sysem inpu is he volage V in () and he sysem oupu is he volage across he capacior, V ou ().
EE 301 Lab 2 Coninuous-ime convoluion Q 3. 1 s order differenial equaion: Wih he use of Kirchoff s volage law and he relaionship beween curren and volage in a capacior, show ha: dvou () RC Vou ( ) Vin ( ). d The soluion o he above equaion is: /( RC) 1 ( )/( RC) Vou ( ) V0e e Vin ( ) d, 0, RC 0 where we will assume he iniial condiion of he volage across he capacior is zero, or V 0 = 0 vols. c. Impulse Response of RC circui To obain he impulse response of he RC circui, we mus supply an impulse funcion (dela funcion) as he inpu. However, a dela funcion is no a physically realizable signal, and even if i were available, we may fry or damage he circui. We mus hen resor o he Heaviside uni sep funcion o help us obain he impulse response. Remember ha we can use wo uni sep funcions o creae a recangular pulse signal. This recangular pulse signal can be used o approximae he dela funcion as he widh of he pulse becomes sufficienly small. Le us define he pulse as, 1 p ( ) u u for 0, d. Sep Response of RC circui The convoluion inegral allows us o obain he sysem response, y(), if we know he sysem s impulse response, h(), and he inpu signal, x(). The oupu is hen, y( ) x( ) h( ) x h d x h d, where he symbol * denoes he convoluion operaion. The sep response, y s (), is found by applying a Heaviside sep funcion as he inpu, or x() = u(). Thus, y ( ) u( ) h( ) h u d h d, s since he Heaviside sep funcion evaluaes o 1 for - τ > 0 and 0 for - τ < 0. By aking he derivaive wih respec o ime of y s () we find ha, dys () d h d h( ). d d The above resul ells us ha he impulse response h() can be compued by calculaing he derivaive of he sep response wih respec o ime. 3
EE 301 Lab 2 Coninuous-ime convoluion Q 4. Obain y s (): Using he resul of he 1 s order differenial equaion ha relaes V in () o V ou (), obain he sep response y s () = V ou () if he inpu is a Heaviside sep funcion, u() = V in (). Aside: In some exbooks he Heaviside sep funcion is denoed as H() no u(). Q 5. Obain h(): Using he sep response, y s (), find he impulse response h(). Q 6. Obain pulse response par 1: Using he pulse p Δ (as defined above) as he inpu V in (), and using he impulse response h() ha you found in Q 5, deermine he oupu response V ou (). We will call his oupu response y (). Q 7. Obain pulse response par 2: Compue rule o evaluae lim 0 /( RC) e 1. lim y ( ). You can use l Hopial s 0 e. EXTRA CREDIT In-Lab Verificaion of Pulse Response: Build he RC circui on a prooboard, wih R = 1 kω and C = 1 μf. You may need o be flexible on he values of R and C. As a reference, you can plo he expeced capacior volage as a funcion of ime using Malab. Connec Channel 1 o measure V in () and Channel 2 o measure V ou (). Make sure ha he oscilloscope channels are se for DC coupling. Use he funcion generaor o produce a 100 mv pulse wih duraion of 1 ms. Collec he measured daa. Repea for a 200 mv pulse wih duraion 0.5 ms and again for a 1 V pulse wih duraion 0.1 ms. Leaving he duy cycle of he square wave o 50%, wha happens as you decrease he duraion of he pulse? In erms of he convoluion process, wha do you expec is happening? Can you devise a plan o obain he impulse response? Hin: I is imporan o consider he he ime consan of he RC circui. 5 Review 1. None.
EE 301 Lab 2 Coninuous-ime convoluion 6 Lab Repor 1. The firs page of your Lab repor should be a cover shee wih your name, USC ID and Lab #. Please noe ha all repors should be yped. 2. Answer all he quesions which were asked in he lab repor. Kindly display he code lines you execued o arrive a your answer along wih figures o suppor hem. Please give wrien explanaion or pu commen lines where necessary. Please noe ha each figure should have proper labels for he x and y axis and should have a suiable ile. 3. Answer he review quesions. 4. Submi a prinou of your compleed M-file documening all he lab exercises. 5