Ee343 signals and systems - lab 2 - loren schwappach
1. 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
LSchwappach@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 convolving
visualization of mathematics, physics, and applied their input function with the defined impulse response.
engineering. In this lab exercise MATLAB will be used to
determine the output response of discrete convolution Our first demonstration of convolution involves the
problems. main impulse response convolved with the shifted impulse
Given the following impulse response: response below:
.
.
The MATLAB code need to create this shifted impulse
Use 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.
2. 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 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] 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 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)
3. 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
nd
[1] Haykin, S., “Signals and Systems 2 Edition” McGraw-
Hill, New York, NY, 2007.