How do I calculate the impulse response?

K
kulkarni · Dec 6, 2021 · 2.1K views
Question
How do I write the code in order to get the impluse response for the following equation:   y[n]=x[n]+x[n-1]+x[n-2]
Expert Answer
Profile picture of Neeta Dsouza
Neeta Dsouza PhD Expert
Answered Aug 24, 2026

TRY THIS:

f=100;% frequanecy
fs=1000;
n=[1:1000]*f/fs;
u=ones(n,1)
x(n)=2*cos(0.5*pi*n).u(n);
% ~ (check indexes im not sure ..)
y(n)=x(n(3:1000))+x(n(2:999))+x((1:998))
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!