Analogue Modeling Tutorial

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Analogue Modeling Tutorial
Hi all,
Some have seen it already, I spent some time of my current vacation starting a blog about the things that move me, which currently is Analogue Modeling. While it's far from complete, I've used nice graphics, easy layout and my own (nonacademic) language to describe what Analogue Modeling means to me, most predominantly on the example of one pole lowpass filters. If it was a book, today I would have closed the first act by posting hands on source code:
Read in chronological order:
https://urs.silvrback.com/zerodelayfeedback
https://urs.silvrback.com/numericalintegration
https://urs.silvrback.com/analoguemodeling
https://urs.silvrback.com/onepoleunlimited
https://urs.silvrback.com/onepolemonster
The future outlook for this will contain use cases for Jacobians, complex component models, part tolerances, prototyping with Qucs, "making it sound good" and what not, but that'll take some time, maybe until my next vacation. Inbetween I'll probably post my quarterly rant or something, but can't say yet.
Also, I'm hoping for feedback in case I missed something or in case someone would like to share his method of doing things.
Enjoy,
 Urs
Some have seen it already, I spent some time of my current vacation starting a blog about the things that move me, which currently is Analogue Modeling. While it's far from complete, I've used nice graphics, easy layout and my own (nonacademic) language to describe what Analogue Modeling means to me, most predominantly on the example of one pole lowpass filters. If it was a book, today I would have closed the first act by posting hands on source code:
Read in chronological order:
https://urs.silvrback.com/zerodelayfeedback
https://urs.silvrback.com/numericalintegration
https://urs.silvrback.com/analoguemodeling
https://urs.silvrback.com/onepoleunlimited
https://urs.silvrback.com/onepolemonster
The future outlook for this will contain use cases for Jacobians, complex component models, part tolerances, prototyping with Qucs, "making it sound good" and what not, but that'll take some time, maybe until my next vacation. Inbetween I'll probably post my quarterly rant or something, but can't say yet.
Also, I'm hoping for feedback in case I missed something or in case someone would like to share his method of doing things.
Enjoy,
 Urs

hibrasil
 KVRian
 792 posts since 24 Jun, 2002 from UK
Re: Analogue Modeling Tutorial
this looks great Urs, thankyou!
My Website  iPlug2  Web Audio Modules  WAMs  Oli Larkin Plugin's Facebook
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)
Available for Audio Dev tuition via Skype (IPlug/JUCE/C++)

Z1202
 KVRian
 1060 posts since 12 Apr, 2002
Re: Analogue Modeling Tutorial
Thanks for sharing. I glanced over, it'd be interesting to read about your way of treating nonlinearities (later )
One thing I noticed, you claim that both transistor ladder and OTA result in the tanh difference. From my own investigation and IIRC from Antti's work, OTA results in tanh of the difference, rather than difference of tanh. Do you have any pointers to the derivation of that result? (Or did I miss them in your blog text?)
Thanks,
{Z}

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Re: Analogue Modeling Tutorial
OTA cascades typically result in tanh of difference because they feed into the inverting lowpass and thus get mixed into the negative feedback, while the positive port of the OTA is set to ground.Z1202 wrote:Thanks for sharing. I glanced over, it'd be interesting to read about your way of treating nonlinearities (later )
One thing I noticed, you claim that both transistor ladder and OTA result in the tanh difference. From my own investigation and IIRC from Antti's work, OTA results in tanh of the difference, rather than difference of tanh. Do you have any pointers to the derivation of that result? (Or did I miss them in your blog text?)
Thanks,
{Z}
However, if we assume that iOTA = g * ( tanh(V+)  tanh(V) ) which I think I liftend somewhere form the internet (Tim Stichcombe maybe?), you do get exactly the same equation as for the differential transistor ladder  if you connect stages through the positive port.
All with grain of salt because reality always diverges from perfect tanh()s, of course.

Miles1981
 KVRian
 1374 posts since 26 Apr, 2004 from UK
Re: Analogue Modeling Tutorial
Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".
Still, like your code, quite close to how I implemented my scalar NR as well (still a few C/C++ discrepancies).
I would call all your "analytical" "numerical".
Still, like your code, quite close to how I implemented my scalar NR as well (still a few C/C++ discrepancies).

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Re: Analogue Modeling Tutorial
Well I guess the idea is to change the system into something that's possible to solve analytically. I think Mystran's method is a great example because while it's not exactly the same set of equations as those harvested from the nodal analysis, it still retains many of the important properties. Yet it is a system which is solved analytically.Miles1981 wrote:Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".
(I might need to add that aspect)

mystran
 KVRAF
 5352 posts since 12 Feb, 2006 from Helsinki, Finland
Re: Analogue Modeling Tutorial
Well, this is total garbage. In a CA3080 style circuit the two inputs are connected to a differential transistor pair so you get a single "tanh" on the differential voltage, which leads to something like iOTA = g*tanh(V+  V). The result is effectively slewrate limiting rather than saturation in the conventional sense.Urs wrote: However, if we assume that iOTA = g * ( tanh(V+)  tanh(V) ) which I think I liftend somewhere form the internet (Tim Stichcombe maybe?), you do get exactly the same equation as for the differential transistor ladder  if you connect stages through the positive port.
How significant this is for any particular filter varies, but most of them divide down the input voltages pretty low, so it's not really something that makes such a filter scream (you get some subtle detuning typically and if you push it harder, you just tend to get something resembling a triangle); if they "scream" they practically always do so for some other reason. In fact, the OTA output nonlinearity can be much more important if there is significant saturation in the negative feedback path and in some (screaming!) filters it's actually necessary to model this (in one way or another) simply to keep the thing from blowing up!
But hey, let's just slap some random tanh() on the inputs and call it an "OTA model", it's not like most of the people reading are going to know any better anyway.
Ps. I do understand that your intention is to present a method for solving systems, not demonstrate a perfect OTA model, but I don't think it helps anyone to spread information that for all practical purposes is simply wrong.
If you'd like Signaldust to return, please ask Katinka Tuisku to resign.

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Re: Analogue Modeling Tutorial
Well, I wouldn't take anything for granted in electronics I'll happily fix the OTA formula  it just makes the filter less flexible, but d'oh. In the end, the bleed through of the control voltage might be even more defining for the sound than the positioning of the wvaeshaper.

Miles1981
 KVRian
 1374 posts since 26 Apr, 2004 from UK
Re: Analogue Modeling Tutorial
As Ivan said, it's still a numerical method, as you have to do a numerical approximation before using the analytical solutionUrs wrote:Well I guess the idea is to change the system into something that's possible to solve analytically. I think Mystran's method is a great example because while it's not exactly the same set of equations as those harvested from the nodal analysis, it still retains many of the important properties. Yet it is a system which is solved analytically.Miles1981 wrote:Analytical is suppsoed to be when you solving the equation analytically, which is not possible in our case, isn't it?
I would call all your "analytical" "numerical".
(I might need to add that aspect)

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Re: Analogue Modeling Tutorial
Hmmm... so the s[n] value that's already there doesn't count?Miles1981 wrote:As Ivan said, it's still a numerical method, as you have to do a numerical approximation before using the analytical solution
Interesting. Looks like I'm learning so much from the feedback, I might just have to rewrite the whole thing

Miles1981
 KVRian
 1374 posts since 26 Apr, 2004 from UK
Re: Analogue Modeling Tutorial
I mean, analytical is when you are analytically solving the original equation (which is what you said can't work). Numerical solutions is anything that approximates the soltuion through numrical methods, from the one steps methods to the NR methods to more complex schemes. They are all numerical methods.
See for instance http://math.stackexchange.com/questions ... oproblems
See for instance http://math.stackexchange.com/questions ... oproblems

Urs
 uhe
 23857 posts since 8 Aug, 2002 from Berlin
Re: Analogue Modeling Tutorial
Hmmm, yeah, I see what you mean.Miles1981 wrote:I mean, analytical is when you are analytically solving the original equation (which is what you said can't work). Numerical solutions is anything that approximates the soltuion through numrical methods, from the one steps methods to the NR methods to more complex schemes. They are all numerical methods.
See for instance http://math.stackexchange.com/questions ... oproblems
But wouldn't you say that if the one step methods were looked at isolated from any relation to circuit modeling, they could be seen as analytical?

Miles1981
 KVRian
 1374 posts since 26 Apr, 2004 from UK
Re: Analogue Modeling Tutorial
Well, we are still trying to solve an equation, whether it comes from a circuit or not.
If I was given an equation to solve with tanh(x) + x = 0 for instance, there are no analytical way of solving this. I could go for one of the one step methods, of course, but that would be a numerical method.
I agree that you are analytically solving an equation, but that's an equation derived fromt he original problem where you are assuming different things to ensure/hope that the solution is numerically close to the original one. Hence the term numerical, and not analytical IMHO.
If I was given an equation to solve with tanh(x) + x = 0 for instance, there are no analytical way of solving this. I could go for one of the one step methods, of course, but that would be a numerical method.
I agree that you are analytically solving an equation, but that's an equation derived fromt he original problem where you are assuming different things to ensure/hope that the solution is numerically close to the original one. Hence the term numerical, and not analytical IMHO.

Z1202
 KVRian
 1060 posts since 12 Apr, 2002
Re: Analogue Modeling Tutorial
There is an interesting terminological detail in regards to what can be considered an analytical solution.Miles1981 wrote:Well, we are still trying to solve an equation, whether it comes from a circuit or not.
If I was given an equation to solve with tanh(x) + x = 0 for instance, there are no analytical way of solving this. I could go for one of the one step methods, of course, but that would be a numerical method.
I agree that you are analytically solving an equation, but that's an equation derived fromt he original problem where you are assuming different things to ensure/hope that the solution is numerically close to the original one. Hence the term numerical, and not analytical IMHO.
Think that tanh cannot be directly computed using machine code instructions either. It is using a numerical method implemented in the library.
Thus, when we say "solve analytically", we actually mean "express the solution as a finite combination of the standard functions and operations".
An equation of the form ax+tanh(x)=0, if solved against x with parameter a, implicitly defines a function x=f(a). If we implement a routine for computing this function, then we can formally add f(a) to our set of standard functions and say that we have an analytical solution of the equation. It's really just about which functions you have in the library and which you don't
Unfortunately, in practical nonlinear ZDF equations these functions have more than one argument. Therefore they cannot be easily tabulated. Still, a numerical solution method, encapsulated into a library function, could be viewed as an "analytical solution". The problem is how reliable is this function implementation in the sense of
 does it give correct answers for all possible parameters?
 how does its computation time (convergence speed) depend on the parameters?
The library functions typically are expected to give correct answers for any parameter values in the function's domain and have "reasonable", close to constant, convergence time. Now, does the same hold for our ZDF solution algorithms?

userb420
 KVRer
 25 posts since 14 Nov, 2012
Re: Analogue Modeling Tutorial
This is a great idea and awesome gesture, will be reading tonight. Thanks Urs!