I want to filter the x signal given using the following filters using the filter command.

2 ビュー (過去 30 日間)
Deniz Bozdogan
Deniz Bozdogan 2021 年 11 月 29 日
編集済み: Srijith Kasaragod 2021 年 12 月 2 日
Hello, i have the following filters given to me:
FIR Filter:
y[n] = 0.4x[n]+0.3x[n1]+0.2x[n2]+0.1x[n3]
IIR Filter:
y[n] = 0.5y[n 1] 0.1y[n 2] + 0.3x[n] 0.2x[n 1] + 0.1x[n 2]
I want to filter the following signal using these two filters with filter command
x[n] = cos(0.1πn) + cos(0.5πn) + cos(0.9πn)
Can you help me on this problem, i could not understand the filter command. Thanks in advance

回答 (1 件)

Srijith Kasaragod
Srijith Kasaragod 2021 年 12 月 2 日
編集済み: Srijith Kasaragod 2021 年 12 月 2 日
Hi Deniz,
Inorder to call "filter" function, you need to pass the denominator and numerator coefficents for the rational transfer function. To obtain the transfer function from the filter difference equation, you can apply Z-transform. For the FIR filter, the coefficients can be computed as:
Z-Transfrom gives,
rearranging,
From the transfer function, numerator and denominator coefficients are assigned to variables "b" and "a" respectively, and passed to "filter" function along with input signal.
n=-5:0.1:5;
x= cos(0.1*pi*n)+cos(0.5*pi*n)+cos(0.9*pi*n);
b=[0.4 0.3 0.2 0.1];
a=1;
y=filter(b,a,x);
plot(n,x);
hold on;
plot(n,y);
legend('signal','filteroutput');
hold off;
Similarly, you can filter "x" using IIR filter.
Hope this helps!

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by