Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Computer Project 2 - Convolution and Simulation of Linear Systems | EE 322, Study Guides, Projects, Research of Electrical and Electronics Engineering

Material Type: Project; Professor: Shaw; Class: Linear Systems II; Subject: Electrical Engineering; University: Wright State University-Main Campus; Term: Spring 2009;

Typology: Study Guides, Projects, Research

Pre 2010

Uploaded on 08/18/2009

koofers-user-we8-1
koofers-user-we8-1 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE 322/522 Linear Systems II
Computer Project 2: Convolution and Simulation of Linear Systems
Due Date: May 5, 2009
1. Use convolution sum to find the response of an LTI system. Let the input signal be given by:
( ) 2*( ( -0.05)- ( - 0.64)),x t u t u t
where,
( ) ut
denotes a unit step function. The Impulse Response of the LTI system is given by,
-4
( ) e ( ( ) - ( - 0.8)),
t
h t u t u t
(an FIR filter)
Both the input signal and the impulse response are to be sampled with a sampling interval of
T=0.01s.
(a) INPUT GENERATION:
The input is sampled from t = 0 and exactly 64 samples are collected. Hand-calculate the number
of zeros at the beginning of the input and the number of ones. Then use the MATLAB commands
"ones" and "zeros" to create the input sequence, x(n). Note that, N1 = 64.
Examples:
>> v1 = zeros(1,4); % Creates a row vector with 4 zeros, i.e., v1 = [0 0 0 0]
>> v2 = ones(1,5); % Creates a row vector with 5 ones. i.e., v2 = [1 1 1 1 1]
>> v3 = [v1 v2]; % Concatenates v1 and v2 to form a larger row vector v3.
% In this case, v3 = [0 0 0 0 1 1 1 1 1].
>> v3 = [zeros(1,4) ones(1,5)] ; % Is equivalent to the previous three commands.
>> length(v3); % Will return the length of the vector v3.
% In this case, the result is 9.
- The nth member of an array can be addressed by, x(n). For example, if x is formed as,
>> x = [-1 3 -5 4 2 4];
then, x(1) =-1, x(2)=3, and so on. The
m
th through
n
th members of a sequence can be
addressed by x(m:n). In the above example, x(1:3) = [-1 3 -5] and x(4:6) = [4 2 4].
pf3

Partial preview of the text

Download Computer Project 2 - Convolution and Simulation of Linear Systems | EE 322 and more Study Guides, Projects, Research Electrical and Electronics Engineering in PDF only on Docsity!

EE 322/522 Linear Systems II

Computer Project 2: Convolution and Simulation of Linear Systems

Due Date: May 5, 2009

  1. Use convolution sum to find the response of an LTI system. Let the input signal be given by:

x t ( )  2*( ( - 0.05) - u t u t ( - 0.64)),

where, u t ( ) denotes a unit step function. The Impulse Response of the LTI system is given by,

( ) e ( ( ) - ( - 0.8)),

t

h t  u t u t (an FIR filter)

Both the input signal and the impulse response are to be sampled with a sampling interval of T=0.01s.

(a) INPUT GENERATION:

The input is sampled from t = 0 and exactly 64 samples are collected. Hand-calculate the number of zeros at the beginning of the input and the number of ones. Then use the MATLAB commands "ones" and "zeros" to create the input sequence, x(n). Note that, N1 = 64.

Examples:

v1 = zeros(1,4); % Creates a row vector with 4 zeros, i.e., v1 = [0 0 0 0]

v2 = ones(1,5); % Creates a row vector with 5 ones. i.e., v2 = [1 1 1 1 1]

v3 = [v1 v2]; % Concatenates v1 and v2 to form a larger row vector v3. % In this case, v3 = [0 0 0 0 1 1 1 1 1].

v3 = [zeros(1,4) ones(1,5)] ; % Is equivalent to the previous three commands.

length(v3); % Will return the length of the vector v3. % In this case, the result is 9.

  • The nth member of an array can be addressed by, x(n). For example, if x is formed as,

x = [-1 3 -5 4 2 4];

then, x(1) =-1, x(2)=3, and so on. The m th through n th members of a sequence can be addressed by x(m:n). In the above example, x(1:3) = [-1 3 -5] and x(4:6) = [4 2 4].

(b) IMPULSE RESPONSE GENERATION

Generate the finite length impulse response sequence h(n).

  • What are the start and end times for h?
  • What is the length (N2) of h?

Example:

  • To generate a function f t ( ) 3e-10 t for the time-duration 1s to 10s in increments of 0.1s, first

define the desired time-vector,

t=1:0.1:10; % Generates a time base from 1 to 10, in increments of 0.1. % In this case, t=[1 1.1 1.2 1.3 .... 9.9 10].

Then, generate the signal (^) f t ( )as follows,

f=3exp(-10t); % Will return a sequence of the corresponding function

% values, i.e., [3e-10 3e-11 3e-100 ]

  • To plot the function sequence f with the desired time-scale, use,

stem(t,f,'fill') % NOTE: t and f MUST have the same lengths.

(c) Use the MATLAB command "conv" to obtain the output, y(n). Use,

y = conv(h,x);

  • Make sure that the length of y is as expected, i.e., N = N1 + N2 - 1.

You can verify this by,

N1 = length(x) % The variable N1 is assigned the length of x N2 = length(h) % The variable N2 is assigned the length of h N = length(y) % The variable N is assigned the length of y

Then, generate the plots of x(1:N1), h(1:N2), y(1:N). [3 plots]

Note: You must first generate the longer time-scale required for plotting y. Use,

t=0:0.01:0.01*(N-1); % Creates the maximum time-scale needed

stem(t(1:N1),x,'filled') % Plots the input. Uses only the first N1 of t stem(t(1:N2),h,'filled') % Plots the impulse response. Lengths = N stem(t,y,'filled') % Plots the output. Both t and y have same lengths