Question
ustep = unit step ------------ usamp = unit sample There are two ways to write this code : The first method is : y =
ustep = unit step ------------ usamp = unit sample
There are two ways to write this code :
The first method is :
y = [0 0]; n = -2:20; for k = 0:20 y(k+3)=(0.75).*y(k+2)-(0.125).*y(k+1)+usamp(k)+(0.5).*usamp(k-1); end stem(n,y) grid on;
The second method is:
n = -2:20; h = usamp(n) + (-3*(0.25).^n+ 4*(0.50).^n).* ustep(n-1); stem (n,h); grid on;
For this question I have done the first method and I want you to write it by using the 2nd method:
This is my code:
y = [1 -2]; n = -2:20; for k = 0:20 y(k+3)= 0.75*y(k+2) - 0.125*y(k+1) + ((0.1).^k).*ustep(k)+ (0.5*(0.1).^(k-1).*ustep(k-1)); end stem(n,y) grid on;
The figure for the code should look like this:
----------------------------------------------------------------------------------------------------------------
ustep = unit step ------------ usamp = unit sample
function out = usamp(t) out = 4*heaviside(t).*heaviside(-t); end
function out = ustep(t) out = heaviside(t)+ 0.5*usamp(t); end
x[n] yin! 92[n+1) 92[n] 91 [n+1) 9,16 For the block diagram system shown, obtain the output y[n] for the input x[n] =(0.1)*u[n] assuming initial conditions y[-1]=-2 and y[-2] =1. The work must be done first analytically and plotted using MATLAB for -25n520, and then by using a recursive computation carried out by MATLAB and plotted also. The two solution methods should yield the same result. 1 0.5 G ilreece 0 -0.5 - 1 -1.5 -2 -5 0 5 10 15 20 x[n] yin! 92[n+1) 92[n] 91 [n+1) 9,16 For the block diagram system shown, obtain the output y[n] for the input x[n] =(0.1)*u[n] assuming initial conditions y[-1]=-2 and y[-2] =1. The work must be done first analytically and plotted using MATLAB for -25n520, and then by using a recursive computation carried out by MATLAB and plotted also. The two solution methods should yield the same result. 1 0.5 G ilreece 0 -0.5 - 1 -1.5 -2 -5 0 5 10 15 20Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started