It’s been a long time since I’ve dealt with difference equations and the z-transform, but I wanted to brush up to help me understand zero delay filters and all their implications. Dealing just with a one-pole design (integrator with negative feedback), the Zavalishin book mentions that adding delay to the loop around a trapezoidal integrator would change the transfer function drastically compared to zero feedback. For practice, I wanted to try starting from the one-pole zero delay block diagram in the book and work backwards to difference equations and a transfer response.
I gave it a shot, but my resulting transfer function gives some bad looking shapes in Octave. I’ve been staring at my derivation for a while, but I haven’t been able to figure out where I went wrong. It seems suspicious to me that I ended up with a z^-2 term, but I can’t point to why that should not have happened.
Please let me know where I screwed up in the image below. I used R to represent the constant g/(1+g), and I made nodes for v and w. I used w instead of s just so I wouldn’t accidentally treat it like Laplace math.
What Did I Do Wrong? (Zero Delay Filter Difference Equation)
-
- KVRian
- 1153 posts since 11 Aug, 2004 from Breuillet, France
It is not only suspicious, it is impossible to have a z^-2 if your filter is one pole only and if you have only one delay in the block diagramIt seems suspicious to me that I ended up with a z^-2 term, but I can’t point to why that should not have happened.
Moreover, here is what I would have written :
Code: Select all
y[n] = w[n] + v[n]
w[n] = y[n-1] + v[n-1]
=> y[n] = y[n-1] + v[n-1] + v[n]
v[n] = R(x[n] - w[n])
=> v[n] = R(x[n] - y[n-1] - v[n-1])
v[n] (1 + R z^-1) = R(x[n] - y[n-1]) (here is the typo)
v[n] = R / (1 + R z^-1) . (x[n] - y[n-1])
y[n] = y[n-1] + v[n] + v[n-1]
y[n] = y[n-1] + R / (1 + R z^-1) . (x[n] - y[n-1] + x[n-1] - y[n-2])
(y[n] - y[n-1]) ( 1 + R z^-1) = R (x[n] - y[n-1] + x[n-1] - y[n-2])
y[n] + (2R - 1) y[n-1] + (-R+R) y[n-2] = R x[n] + R x[n-1]
H(z) = (R + R z^-1) / (1 + (2R-1) z^-1)