Login / Register  0 items | $0.00New @ What is KVR? Submit News Advertise

What Did I Do Wrong? (Zero Delay Filter Difference Equation)

DSP, Plug-in and Host development discussion.

Moderator: Moderators (Main)

skrasms
KVRist
 
324 posts since 1 Feb, 2005, from Portland

Postby skrasms; Mon Apr 28, 2014 6:35 pm What Did I Do Wrong? (Zero Delay Filter Difference Equation)

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.

Image
Wolfen666
KVRian
 
724 posts since 11 Aug, 2004, from Marcoussis, France

Postby Wolfen666; Mon Apr 28, 2014 9:38 pm Re: What Did I Do Wrong? (Zero Delay Filter Difference Equation)

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.

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 diagram :wink:

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)


Not 100% sure about the results :D
skrasms
KVRist
 
324 posts since 1 Feb, 2005, from Portland

Postby skrasms; Wed Apr 30, 2014 10:01 pm Re: What Did I Do Wrong? (Zero Delay Filter Difference Equation)

Thank you for catching my typo and posting your work. It actually looks and acts like a 1-pole lowpass filter now. :)

Moderator: Moderators (Main)

Return to DSP and Plug-in Development