Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please solve the following equation using MATLAB , i\'m having a hard time under

ID: 2291611 • Letter: P

Question

Please solve the following equation using MATLAB , i'm having a hard time undersanding it.(Please Paste the codes bellow all steps) ,I have to take my final exam in the next 48 hours.

Problem 1 Consider the discrete-time LTI system characterized by the following difference equation with input and initial conditions specified: yIn] 2 y[n-1]-3y[n-2]x[n], with y[0]1 and y]- 0, x[n] (-1/2)" 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 1s ns 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. * *

Explanation / Answer

clc
clear all
close all
%% Value of y[0] and y[1]
y = [-1 0];
n = 1:10;
x = ((-1/2).^n).*heaviside(n-2);
for i = 1:10
y(i+2) = x(i) + 2*y(i+1) + 3*y(i);
end

result

1.0e+04 *

-0.0001 0 -0.0003 -0.0006 -0.0021 -0.0059 -0.0181 -0.0540 -0.1625 -0.4871 -1.4617 -4.3847

Here we have used x = 0.5 for n = 2. If you need to use one, please change the code accordingly

x = ((-1/2).^n).*floor(heaviside(n-2));

Use above line instead