Ee343 signals and systems - lab 2 - loren schwappach
CTU: EE 343 – Signals and Systems: Lab 2: Convolution in MATLAB 1 Colorado Technical University EE 343 – Signals and Systems Lab 2: Convolution May 2010 Loren Schwappach ABSTRACT: This lab report was completed as a course requirement to obtain full course credit in EE343, Signalsand Systems at Colorado Technical University. Given several input responses this lab report uses MATLAB to examine theprinciple of convolution. If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the processused in designing the indicated circuitry, or the final conclusions and recommendations derived, please send an email toLSchwappach@yahoo.com. All computer drawn figures and pictures used in this report are of original and authentic content. II. PROCEDURE / RESULTS I. INTRODUCTION After defining our impulse response in MATLAB we MATLAB is a powerful program and is useful in the can now calculate various output responses by convolvingvisualization of mathematics, physics, and applied their input function with the defined impulse response.engineering. In this lab exercise MATLAB will be used todetermine the output response of discrete convolution Our first demonstration of convolution involves theproblems. main impulse response convolved with the shifted impulse Given the following impulse response: response below: . . The MATLAB code need to create this shifted impulseUse MATLAB to find the output response, y[n], by convolving response is below as is it’s stem graph.several input responses with the impulse response. The main >> x = [0 1 0 0 0 1 0 0 0 0 -1]; >> stem(n,x)system impulse response is shown in figure 1 below.MATLAB code for impulse response:>> n = [0:10];>> h = 3 * (((2/3)*ones(1,11)).^n);>> stem(n,h) Figure 2: Shifted Input Impulse Response x[n] Now the impulse response h[n] must be convoluted with the shifted impulse response x[n] to produce the output response y[n]. This is accomplished with the conv() function in Figure 1: Impulse Response h[n] MATLAB. The results of this convolution and MATLAB code follow.
CTU: EE 343 – Signals and Systems: Lab 2: Convolution in MATLAB 2MATLAB Code:>> n = [0:20];>> y=conv(x,h);>> stem(n,y) Figure 5: Output Response y[n] Finally, the input of a pulse response x[n] defined below is convolved with the original impulse response h[n]. MATLAB Code:Figure 3: Output response y[n] >> x = [0 0 1 1 1 1 0 0 0 0 0]; >> n = [0:10];Next a unit step response x[n] = u[n] is represented in >> stem(n,x)MATLAB and convolved with the input response h[n] toproduce a second output response y[n].MATLAB Code:>> x = [ones(1,11)];>> y=conv(x,h);>> n = [0:10];>> stem(n,x) Figure 6: Rectangular Pulse Response x[n] >> y=conv(x,h); >> n=[0:20]; >> stem(n,y) Figure 4: Step Response x[n] = u[n]>> n = [0:20];>> stem(n,y)
CTU: EE 343 – Signals and Systems: Lab 2: Convolution in MATLAB 3Figure 7: Output Response y[n] III. EVALUATION . By hand calculating the output responseresults from the convolution of the impulse response h[n]with the input of the shifted impulse response: .You can see (Hand calculations are attached to this report).the output response y[n] is simply the summation of theimpulse response h[n] occurring at each of the impulsesdefined in x[n]. This is the beauty of impulse functions, andverifies that are MATLAB data is correct. IV. CONCLUSIONS. MATLAB is a great utility for representing complexconcepts visually and can easily be manipulated to showsignals in various formats. This lab project was successful indemonstrating MATLABs powerful features in a quick andeasy method, and demonstrating how MATLAB can be usedfor convolving discrete-time signals. REFERENCES nd Haykin, S., “Signals and Systems 2 Edition” McGraw- Hill, New York, NY, 2007.