## You are probably already using Zero Delay Feedback filters, so let your customers know!

andy-cytomic
KVRAF

2094 posts since 3 Dec, 2008
mystran wrote:
andy-cytomic wrote:
mystran wrote:Well, in the thread you mentioned (at least not in the original post), I don't remember doing any nodal analysis, because I just pretty much assumed a bunch of differential equations as the ground truth.

Ok so where did the differential equations come from?

You're missing the point. Getting from a circuit to code is really a two step problem: first you need a model of the circuit, and then you need a method for numerically solving the model. You can solve each of these sub-problems separately and they are essentially independent as far as particular techniques go.

I (quite explicitly I might add) made no attempt to do anything about the first part in that thread (because the thread wasn't about circuit modeling; it was about zero delay filters), so there was no need to even consider MNA. I picked a bunch of familiar equations as given, and it doesn't really matter how those equations came to be, since the subject was the second part: how to write an implementation that numerically solves those.

I'm making such a fuzz about this, because I think both problems are interesting on their own right... but at the same time you can pretty much "plug and play" any solution for any of the sub-problems and still have it all work just fine.

No points were missed, I was letting people know the first step exists and needs to be solved at some point, and not glossing over that fact.

Yes, the two problems can be separated if you want, but they don't have to be, please point out where I have said otherwise and I will correct what I have said.

Writing down the possibly non-linear differential equations has nothing to do about "feedback" as such, for many circuits you can write down such equations and there is no feedback at all in the original circuit that needs solving without adding a delay. For example the passive RC and active one pole low pass filters have identical differential equations, but one original circuit had feedback and one didn't. There is no "feedback" as such in the resultant equation (they are both the same) since they abstract out such things and just represent the system as possibly implicit equations to solve.
The Glue, The Drop - www.cytomic.com
KVRian

1029 posts since 8 Feb, 2012, from South - Africa
andy-cytomic wrote:
http://www.kvraudio.com/forum/viewtopic.php?t=349859

then this isn't Euler (forward or backward), it is trapezoidal, and it isn't a one step method, it is an iterative solver but he only does the first step.

mystran wrote:
The point of this exercise is that we can now treat the non-linear transconductance and the actual input separately. So what we can do, is combine Euler method for the non-linearity with trapezoidal method for the linear part!

mystran
KVRAF

4927 posts since 11 Feb, 2006, from Helsinki, Finland
mystran wrote:The point of this exercise is that we can now treat the non-linear transconductance and the actual input separately. So what we can do, is combine Euler method for the non-linearity with trapezoidal method for the linear part!

That doesn't really make any sense though; it's just plain wrong and confusing.

What I tried to say there is "treat the non-linearities like you'd normally treat them with [explicit] Euler" but even that doesn't really make much sense. It's the sort of text that you get when you try to explain something that is essentially a kludge.

Essentially it comes down to trapezoidal as usual, but replace derivatives with the hack and just skip iteration. The problem is, that wasn't how I arrived at the method originally, which is why the original description is so horribly confusing and misleading. [And I just got a deja vu, as if I'd tried to correct that part at least a few times before.. maybe I should go back and edit it, so people couldn't quote it anymore.]

I often wish I hadn't started that topic at all, since it seems like people keep referring to it as if it's the best way to do something. At the time I was trying to figure out what works, and what doesn't and this was one of the things that (sort-of) worked. For some strange reason I then decided to share it. Sadly, I probably did that before I fully understood it all.
<- plugins | forum
KVRian

1029 posts since 8 Feb, 2012, from South - Africa
mystran wrote:I often wish I hadn't started that topic at all,

It was my fault for not checking - but who cares about semantics, it works, and it is a smart solution for a tricky problem.

mystran wrote: ...since it seems like people keep referring to it as if it's the best way to do something.

It's because it's the easiest explenation there is on the topic, no electrical laws, no complex math - simple and elegant. Personally I understood that thread more than Vadim's book, and for that I thank you. You have a knack for explaining complex things with a down to earth style.
mystran
KVRAF

4927 posts since 11 Feb, 2006, from Helsinki, Finland
andy-cytomic wrote:Writing down the possibly non-linear differential equations has nothing to do about "feedback" as such, for many circuits you can write down such equations and there is no feedback at all in the original circuit that needs solving without adding a delay.

Oh.. I wholeheartedly agree with this. I was just using the term ZDF since that was the term people were using on the forum at the time in reference to such methods [and it's also in the topic of this thread, so clear you have some idea of how it's conventionally used]. You see.. personally I don't really care if white wine is actually mostly transparent and usually has some yellowish color.
<- plugins | forum
camsr
KVRAF

6820 posts since 16 Feb, 2005
I was under the impression that ZDFs are very accurate compared to the older filters. They don't warp the same.
andy-cytomic
KVRAF

2094 posts since 3 Dec, 2008
mystran wrote:
mystran wrote:The point of this exercise is that we can now treat the non-linear transconductance and the actual input separately. So what we can do, is combine Euler method for the non-linearity with trapezoidal method for the linear part!

That doesn't really make any sense though; it's just plain wrong and confusing.

What I tried to say there is "treat the non-linearities like you'd normally treat them with [explicit] Euler" but even that doesn't really make much sense. It's the sort of text that you get when you try to explain something that is essentially a kludge.

Essentially it comes down to trapezoidal as usual, but replace derivatives with the hack and just skip iteration. The problem is, that wasn't how I arrived at the method originally, which is why the original description is so horribly confusing and misleading. [And I just got a deja vu, as if I'd tried to correct that part at least a few times before.. maybe I should go back and edit it, so people couldn't quote it anymore.]

I often wish I hadn't started that topic at all, since it seems like people keep referring to it as if it's the best way to do something. At the time I was trying to figure out what works, and what doesn't and this was one of the things that (sort-of) worked. For some strange reason I then decided to share it. Sadly, I probably did that before I fully understood it all.

I think the "technically correct" way to view this is that numerical root finding methods need an initial guess, and for this guess in the method Mystran described he used the previous state instead of the previous output voltage. This previous state has an effective delay of 1/2 a sample, which is good, but the tradeoff here is the frequency response of this term being wrong, which isn't good. This is why I did the plots showing this at the end of the thread, there is a boost up high. The other difference, as already mentioned, is using f(x)/x instead of f'(x), which cancels out any offset terms in the newton raphson solver:

f(x) = f'(x) x + offset
f(x) = (f(x)/x) x + offset
f(x) = f(x) + 0

Which reduces the number of terms in the solution, but also makes convergence much slower. But like Mystran has pointed out here was more interested in calculating the most stable solution possible after one step. I tried using this method as a predictor step but found it actually made things worse that what I currently do.

The Glue, The Drop - www.cytomic.com
matt42
KVRian

997 posts since 9 Jan, 2006
camsr wrote:I was under the impression that ZDFs are very accurate compared to the older filters. They don't warp the same.
An advantage of TPT filters are that by preserving the topology of the filter while at the same time as incorporating zero delay feedback paths you incur much less frequency warping and other negative effects of more naive topology preserving filters with unit delays in the feedback paths, like the Chamberlin SVF for example.

However if looking at a strictly LTI case a TPT filter is equivalent to a filter designed via the BLT. They both can suffer noticeable frequency warping at 44100. Advantages of TPT design over BLT are improved parameter modulation and being able to place non-linearities in feedback paths.
andy-cytomic
KVRAF

2094 posts since 3 Dec, 2008
matt42 wrote:
camsr wrote:I was under the impression that ZDFs are very accurate compared to the older filters. They don't warp the same.
An advantage of TPT filters are that by preserving the topology of the filter while at the same time as incorporating zero delay feedback paths you incur much less frequency warping and other negative effects of more naive topology preserving filters with unit delays in the feedback paths, like the Chamberlin SVF for example.

However if looking at a strictly LTI case a TPT filter is equivalent to a filter designed via the BLT. They both can suffer noticeable frequency warping at 44100. Advantages of TPT design over BLT are improved parameter modulation and being able to place non-linearities in feedback paths.

And the so called "topology preserving transform" (TPT) is just a special case of regular topology preserving circuit solving methods using trapezoidal integration. In fact all explicit and implicit circuit solving methods could equally be called TPT, since they can all be viewed as transforms and they all preserve the topology. In general trapezoidal is a good choice, but not always the best depending on the situation, so knowing where the TPT fits into regular and well established circuit solving maths is useful, especially when solving non-linear systems with possibly stiff terms.
The Glue, The Drop - www.cytomic.com
matt42
KVRian

997 posts since 9 Jan, 2006
andy-cytomic wrote:In fact all explicit and implicit circuit solving methods could equally be called TPT, since they can all be viewed as transforms and they all preserve the topology.
Could be, but in fact aren't.

Please correct me if I'm wrong, but the term TPT was coined specifically for the methods outlined in Vadeem's book. As such it is an entirely unambiguous and valid term.
andy-cytomic
KVRAF

2094 posts since 3 Dec, 2008
matt42 wrote:
andy-cytomic wrote:In fact all explicit and implicit circuit solving methods could equally be called TPT, since they can all be viewed as transforms and they all preserve the topology.
Could be, but in fact aren't.

Please correct me if I'm wrong, but the term TPT was coined specifically for the methods outlined in Vadeem's book. As such it is an entirely unambiguous and valid term.

They are in fact topology preserving, and do in fact transform a continuous system to a discrete one, so yes they are topology preserving transforms. Back in the 1970's when all this maths was sorted, no one previously bothered coming up with an acronym for all this because this is taken for granted if you are trying to simulate a circuit accurately that you need to preserve the structure of the circuit. Could you imagine firing up a circuit simulator and placing a virtual probe somewhere and getting some intermediate abstracted state as the value? That's just not useful.

Perhaps a bad analogy is in order? Lets look at pasta sauces like Bolognese, Napolitana, Arrabbiata etc. These are all obviously red in colour. Now say someone comes along and defines Bolognese as RPS (red pasta sauce), then that's all good and well, but what about the other ones? They are also red in colour and pasta sauces, are they suddenly banned from being called red pasta sauces? This is what happens if you go ahead and use very generic terminology.
The Glue, The Drop - www.cytomic.com
matt42
KVRian

997 posts since 9 Jan, 2006
Ever heard of white sauce? In England if I refer to Brown Sauce most people will immediately know which style of brown sauce I'm referring to despite the many varieties of sauce which also happen to be brown.

If I mention TPT here a lot of people, including yourself, know exactly what I'm talking about.
Banned
As someone who's NOT using [the unspeakable term for whatever you want to call it], how about some of you geniuses share the algo with us, considering how it's all common knowledge and everything.

A few lines of code or pseudocode, please. Unpronounceable math symbols and opaque terminology not required or helpful. Nor is introduction of non-linearities. Just a nice straight linear IIR with negative feedback. For us simpletons. Please?
matt42
KVRian

997 posts since 9 Jan, 2006
AdmiralQuality wrote:As someone who's NOT using [the unspeakable term for whatever you want to call it], how about some of you geniuses share the algo with us, considering how it's all common knowledge and everything.

A few lines of code or pseudocode, please. Unpronounceable math symbols and opaque terminology not required or helpful. Nor is introduction of non-linearities. Just a nice straight linear IIR with negative feedback. For us simpletons. Please?
I am most definitely one of those simpletons As a result I know exactly what you are talking about and I had guessed there are might be a lot of people who also feel the same. I'm putting together a tutorial that should be understandable to most people who are into DSP and the knowledge would be general enough to be applied to any analogue filter prototype. So people would get much more than a black box understanding. I'm about 80% there.
Banned
matt42 wrote:
AdmiralQuality wrote:As someone who's NOT using [the unspeakable term for whatever you want to call it], how about some of you geniuses share the algo with us, considering how it's all common knowledge and everything.

A few lines of code or pseudocode, please. Unpronounceable math symbols and opaque terminology not required or helpful. Nor is introduction of non-linearities. Just a nice straight linear IIR with negative feedback. For us simpletons. Please?
I am most definitely one of those simpletons As a result I know exactly what you are talking about and I had guessed there are might be a lot of people who also feel the same. I'm putting together a tutorial that should be understandable to most people who are into DSP and the knowledge would be general enough to be applied to any analogue filter prototype. So people would get much more than a black box understanding. I'm about 80% there.

Cool. Let us know. I think mystran attempted something a while back, but I stopped paying attention after he was still revising the code after 10 pages of discussion. Also, if I remember correctly, I think he was obsessing on non-linearities which is a secondary concern I'd like to separate from the "zero delay" (don't hit me!) thing.
PreviousNext

Moderator: Moderators (Main)