LTI Systems3studs
LTI Systems3studs
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
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)
x ( k ) h( n k ) x ( n) * h( n)
Convolution Equation
Commutative Law
y ( n)
h( k ) x ( n k ) h( n) x ( n)
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)
Cascade Form
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
4 0
Convolution is distributive!!!!
Plot from 0 n 9,
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
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)
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