How do I calculate the impulse response?

9 ビュー (過去 30 日間)
dhanshri kulkarni
dhanshri kulkarni 2015 年 2 月 26 日
回答済み: Altanshagai 2023 年 3 月 10 日
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]

採用された回答

michael scheinfeild
michael scheinfeild 2015 年 2 月 26 日
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))
  1 件のコメント
Jens Kritian Poulsen
Jens Kritian Poulsen 2021 年 3 月 2 日
編集済み: Jens Kritian Poulsen 2021 年 3 月 2 日
There are errors in the solution shown by Michael Scheinfeild, e.g. last line and it doesn't calculate the impulse response.
The solution by John D'Errico is okay (albeit a bit short)
The problem by itself is so simple you don't really need Matlab ([1 1 1] is the impulse response).

サインインしてコメントする。

その他の回答 (3 件)

John D'Errico
John D'Errico 2015 年 2 月 26 日
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?

MathWorks Support Team
MathWorks Support Team 2019 年 5 月 22 日
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.

Altanshagai
Altanshagai 2023 年 3 月 10 日
[1 1 1]

カテゴリ

Help Center および File ExchangeFilter Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by