For Loop Code Something about IIR

1 次查看(过去 30 天)
Can someone help me to loop my code? My code is from python but I struggling to loop it here in Matlab, this code is something about IIR filter
So here is my code:
c5 = 8
c4 = 2
c3 = 7
b0 = 0.05*c5
b1 = 0.03*c4
b2 = 0.02*c3
a1 = 0.5
a2 = 0.5
print(b0,"b0\n",b1,"b1\n",b2,"b2\n",a1,"a1\n",a2,"a2")
k0 = b0
k1 = b1 + k0*a1
k2 = b2 + k1*a1 + k0*a2
k3 = k2*a1 + k1*a2
k4 = k3*a1 + k2*a2
k5 = k4*a1 + k3*a2
k6 = k5*a1 + k4*a2
print("k0 = ", k0)
print("k1 = ", k1)
print("k2 = ", k2)
print("k3 = ", k3)
print("k4 = ", k4)
print("k5 = ", k5)
print("k6 = ", k6)
Thanks <3
  7 个评论
Sargondjani
Sargondjani 2021-10-24
It is still not clear what you want...
Akeem Labrador
Akeem Labrador 2021-10-24
Find the first seven impulse response of the IIR filter with filter coefficient b0 = 0.05, b1 = 0.03, b2 = 0.02, a1 = 0.5, a2 = 0.5 using for loop code in matlab

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Filter Design 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by