Ee343 signals and systems - lab 2 - loren schwappach
-
Upload
loren-schwappach -
Category
Technology
-
view
800 -
download
1
description
Transcript of 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, Signals and Systems at Colorado Technical University. Given several input responses this lab report uses MATLAB to examine the principle of convolution.
If you have any questions or concerns in regards to this laboratory assignment, this laboratory report, the process used in designing the indicated circuitry, or the final conclusions and recommendations derived, please send an email to [email protected]. All computer drawn figures and pictures used in this report are of original and authentic content.
I. INTRODUCTION
MATLAB is a powerful program and is useful in the
visualization of mathematics, physics, and applied
engineering. In this lab exercise MATLAB will be used to
determine the output response of discrete convolution
problems.
Given the following impulse response:
.
Use MATLAB to find the output response, y[n], by convolving
several input responses with the impulse response. The main
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 1: Impulse Response h[n]
II. PROCEDURE / RESULTS
After defining our impulse response in MATLAB we can now calculate various output responses by convolving their input function with the defined impulse response.
Our first demonstration of convolution involves the
main impulse response convolved with the shifted impulse response below:
.
The MATLAB code need to create this shifted impulse response is below as is it’s stem graph. >> x = [0 1 0 0 0 1 0 0 0 0 -1]; >> stem(n,x)
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 MATLAB. The results of this convolution and MATLAB code follow.
CTU: EE 343 – Signals and Systems: Lab 2: Convolution in MATLAB 2
MATLAB Code: >> n = [0:20]; >> y=conv(x,h); >> stem(n,y)
Figure 3: Output response y[n] Next a unit step response x[n] = u[n] is represented in MATLAB and convolved with the input response h[n] to produce a second output response y[n]. MATLAB Code: >> x = [ones(1,11)]; >> y=conv(x,h); >> n = [0:10]; >> stem(n,x)
Figure 4: Step Response x[n] = u[n]
>> n = [0:20];
>> 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: >> x = [0 0 1 1 1 1 0 0 0 0 0]; >> n = [0:10]; >> stem(n,x)
Figure 6: Rectangular Pulse Response x[n] >> y=conv(x,h); >> n=[0:20]; >> stem(n,y)
CTU: EE 343 – Signals and Systems: Lab 2: Convolution in MATLAB 3
Figure 7: Output Response y[n]
III. EVALUATION
. By hand calculating the output response results 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 the impulse response h[n] occurring at each of the impulses defined in x[n]. This is the beauty of impulse functions, and verifies that are MATLAB data is correct.
IV. CONCLUSIONS
. MATLAB is a great utility for representing complex
concepts visually and can easily be manipulated to show
signals in various formats. This lab project was successful in
demonstrating MATLABs powerful features in a quick and
easy method, and demonstrating how MATLAB can be used
for convolving discrete-time signals.
REFERENCES
[1] Haykin, S., “Signals and Systems 2nd Edition” McGraw-Hill, New York, NY, 2007.