Write a MATLAB function that implements the difference equation for the system assuming null initial conditions. Include source code .
y(n) = x(n) + 2x(n-1) + x(n-2) + 0.8 y(n-1) - 0.64 y(n-2)
Use Matlab to calculate the response of the system to p(n) = 0 for all n expect when p(10) = 1.
Using stem, plot the resulting output to n=100
What is the amplitude of the output squence? Was the signal amplified? How much?
code for output response in below
--------------------------------------
%input described in question is a unit inpulse function shifted
10 unit
x=zeros(100,1);
x(10)=1; % delta(n-10)
y=[0 0]; % response
for n=3:100
y=[y,x(n) + 2*x(n-1) + x(n-2) + 0.8*y(n-1) - 0.64*y(n-2)];
%difference equation
end
stem(y,'filled'); % plot output response
----------------------------------------
plot
in above plot, we can see that amplitude of the output is above 2.5 which dies out after some time thus it is amplified.
Get Answers For Free
Most questions answered within 1 hours.