0% found this document useful (0 votes)
35 views23 pages

LTI Systems3studs

Uploaded by

Krit Jimenez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views23 pages

LTI Systems3studs

Uploaded by

Krit Jimenez
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

LTI systems: Convolution and difference equations

In Matlab
>> x = [ 3 2 1] x= 3 2 1 >> h = [ 2 1 3] h= 2 1 3 >> conv(x,h) ans = 6 7 13 7

length = length(x) + length(h) - 1

Compute by (1) hand (2) with the use of Matlab

A
>> x = [ 0 0 1 2 1 0]; >> h = [ 0 0 1 -1 0 0]; >> y = conv(x,h) y= Columns 1 through 7 0 0 0 0 1 1 -1 Columns 8 through 11 -1 0 0 0

B
>> x = [ 0 1 1 1 1 0]; >> h = [0 0 1 -1 1 0]; >> y = conv(x,h) y= Columns 1 through 7 0 0 0 1 0 1 Columns 8 through 11 0 1 0 0

y (n) output x(n) input h(n) impulse

y ( n)

x ( k ) h( n k ) x ( n) * h( n)

Convolution Equation

x(n) * h(n) h(n) * x(n)


Therefore

Commutative Law

y ( n)

h( k ) x ( n k ) h( n) x ( n)

y (n) output x(n) input h(n) impulse

Associative Law

y (n) [ x(n) * h1(n)] * h 2(n) x(n) * [h1(n) * h 2(n)] y (n) y1(n) * h 2(n) [ x(n) * h1(n)] * h 2(n)

h(n) * h1(n) h2(n)

Cascade Form

y (n) output x(n) input h(n) impulse

Distributive Law

y(n) x(n) *[h1(n) h2(n)] x(n) * h1(n) x(n) * h2(n) h(n) h1(n) h2(n)
Parallel Form

Convolution is commutative!!!

Plot from 0 n 9,

>> x = [ 1 1 1 1 1 0 0 0 0 0]; >> h1 = [ 1 -1 3 0 1 0 0 0 0 0]; >> h2 = [ 0 2 5 4 -1 0 0 0 0 0]; >> y = conv(x,h1) y= Columns 1 through 6 1 0 3 3 4 3 Columns 7 through 12 4 1 1 0 0 0 Columns 13 through 18 0 0 0 0 0 0 Column 19 0

>> y = conv(h1,x) y= Columns 1 through 7 1 0 3 3 4 3 Columns 8 through 14 1 1 0 0 0 0 Columns 15 through 19 0 0 0 0 0

4 0

Therefore convolution is commutative!!!


length = length(x) + length(h) - 1

Convolution is distributive!!!!

Plot from 0 n 9,

>> x = [ 1 1 1 1 1 0 0 0 0 0]; >> h1 = [ 1 -1 3 0 1 0 0 0 0 0]; >> h2 = [ 0 2 5 4 -1 0 0 0 0 0];

>> y= conv(x,h1+h2) y= Columns 1 through 7 1 2 10 14 14 13 12 Columns 8 through 14 4 0 0 0 0 0 0 Columns 15 through 19 0 0 0 0 0

>> y2 = conv(x,h1) + conv (x,h2) y2 = Columns 1 through 11 1 2 10 14 14 13 12 4 Columns 12 through 19 0 0 0 0 0 0 0 0

length = length(x) + length(h) - 1

Therefore convolution is distributive!!!!

Convolution is associative!!!
>> x = [ 1 1 1 1 1 0 0 0 0 0]; >> h1 = [ 1 -1 3 0 1 0 0 0 0 0]; >> h2 = [ 0 2 5 4 -1 0 0 0 0 0];
>> y = conv(conv(x,h1),h2) y= Columns 1 through 7 0 2 5 10 20 35 35 Columns 8 through 14 36 30 20 5 3 -1 0 Columns 15 through 21 0 0 0 0 0 0 0 Columns 22 through 28 0 0 0 0 0 0 0 >> y2 = conv(x,conv(h1,h2)) y2 = Columns 1 through 7 0 2 5 10 20 35 35 Columns 8 through 14 36 30 20 5 3 -1 0 Columns 15 through 21 0 0 0 0 0 0 0 Columns 22 through 28 0 0 0 0 0 0 0

length = length(x) + length(h) - 1

Ex2: Convolution
Determine the unit step response of the system described by the impulse response. Plot using stem command evaluate from n = 0 to 9.
h(n) = 0.75nsin(2*pi*n) [u(n) u(n-10)]
ones(1,10)

n=0:9; hna = 0.75.^n.*sin(2*pi*n).*ones(1,10); x = ones(1,10); y = conv(x,hna); ma = length(y)-1; stem(0:ma,y);

Difference Equations
Filtering filter(b,a,x) filters the vector x using a difference equation where vectors a and b represent the equation coefficients. This command implements the equation

If a = 1, then the command performs the convolution of vectors x and b with the length of the output equal to the length of the input data. If a = [ 1 2 3 4], b = [5 6], conv(a,b) = 5 16 27 38 24, conv(b,a) = 5 16 27 38 24, filter (b,a,x) = 5 6 0, filter(b,1,x) = 5 16 27, filter(x,1,b) = 5 16. x = [ 1 2 3] then:

Able to properly represent the input/output relationship to a given LTI system A linear constant-coefficient difference equation (LCCDE) serves as a way to express just this relationship

y[n]+7y[n1]+2y[n2]=x[n]4x[n1]

Example Write a MATLAB program to simulate the following difference equation 8y[n] - 2y[n1] - y[n-2] = x[n] + x[n-1] initial conditions: x(n) = 5u(n)
>> b = [1 1 0]; >> a = [ 8 -2 -1]; >> x = 5*ones(1,5); >> y = filter(b,a,x) y= 0.6250 1.4063 1.6797 1.8457 1.9214

You might also like