MATLAB Answers

How do I calculate the impulse response?

131 views (last 30 days)
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]

  0 Comments

Sign in to comment.

Accepted Answer

michael scheinfeild
michael scheinfeild on 26 Feb 2015
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))

  0 Comments

Sign in to comment.

More Answers (2)

John D'Errico
John D'Errico on 26 Feb 2015
Use filter, or conv. WTP?
Compute the vector x, then get y from x.
y = conv(x,[1 1 1]);
and if x was [0 0 1 0 0], then what would y be from the above call to conv?

  0 Comments

Sign in to comment.


MathWorks Support Team
MathWorks Support Team on 22 May 2019
To compute a 3 tap FIR filter impulse response, use “fft” with the corresponding coefficients. In this case,
>> fft([1 1 1])
Depending on the frequency resolution that you need, you will also have to specify the length of the transformation.

  0 Comments

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!