Question

# Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and...

Problem 1

Consider the discrete-time LTI system characterized by the following difference equation with input and initial conditions specified:

y[n] - 2 y[n-1] – 3 y[n-2] = x[n] , with y[0] = -1 and y[1] = 0, x[n] = (-1/2)n u[n-2].

? Write a MATLAB program to simulate this difference equation.
You may try the commands ‘filter’ or ‘filtic’ or create a loop to compute the values recursively.

? Printout and plot the values of the input signal, x[n] and the output signal, y[n] over the range 1 ? n ? 10.

? Solve this difference equation by hand using the classical method.

? Verify that the values of the output signal, y[n] produced by MATLAB are the same as those

calculated by hand for the values of n = 2, 3, 4.

MATLAB CODE:

y[n]+3y[n-1]-4y[n-2]=x[n]
y[1]=0 and y[2]=1,
and x[n]=3nu[n]

clc
n=3:5;
a=[1 3 -4];
b=[3 0 0];
yi=[1 0];
xi=[1 1];
x=3*n;
zi=filter(b,a,yi,xi);
y=filter(b,a,3*n,zi);
subplot(2,1,1)
plot(n,y)
xlabel('----n------>')
ylabel('----values---->')
title('plot of output signal y over the range from n=3 to n=5')
subplot(2,1,2)
plot(n,x)
xlabel('----n---->')
ylabel('----values---->')
title('plot of input signal x over the range from n=3 to n=5')

OUTPUT:

#### Earn Coins

Coins can be redeemed for fabulous gifts.