Direct form 2 iir filter

8 views (last 30 days)
mir  khadim
mir khadim on 17 Jan 2019
Edited: Jan on 17 Jan 2019
I am trying to write a code for implementing a direct form 2 based iir filter (without using the filter command), the problem is that i am confused about the intermediate variable (let's call it "w"), isn't "w" just a delayed version of x (x being the input signal), if not, could you help clarify the doubt of how to fill up the intermediate variable i.e "w".
These are the two equations i use to implement the IIR filter in direct form 2, where "b" and "a" represent the filter coeffecients pertaining to the numerator and the denominator of the transfer function.
i went through your function file as well, it works just fine, but i am having a hard time understanding the role of "w(n)".
  1 Comment
Jan
Jan on 17 Jan 2019
Edited: Jan on 17 Jan 2019
If I guess, that your a is defined such, that a(0) is set to 1, your w is the vector of the last M+1 elements of the input scaled by a.
It might get clear, if you write down the equations for a specific |M| and a, b. Then the equivalence between these two equations and the Direct Form II approach in my code gets visible. See this form also:
N M
y(n) = - SUM a(k+1) y(n-k) + SUM b(k+1) x(n-k) for 1<=n<=length(x)
k=1 k=0

Sign in to comment.

Accepted Answer

Jan
Jan on 17 Jan 2019
Edited: Jan on 17 Jan 2019
All you have mentioned yet is the name of the "intermediate" variable "w", but without seeing the definition you use or the code, we cannot guess, what it is.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!