For Loop Code Something about IIR

1 view (last 30 days)
Akeem Labrador
Akeem Labrador on 21 Oct 2021
Commented: Akeem Labrador on 24 Oct 2021
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 Comments
Sargondjani
Sargondjani on 24 Oct 2021
It is still not clear what you want...
Akeem Labrador
Akeem Labrador on 24 Oct 2021
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

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!