I've drawn a following scheme, and now want to write ODE system for describing inner processes, in order to explore it:


simulate this circuit – Schematic created using CircuitLab

I wrote the first part, and it is clear enough, as I have a leaky capacitor:

\$\frac{dV_m}{dt} = \frac{I_{in} - \frac{V_m}{R_m} - I_a*SW1}{C_m}\$

But second part is not clear at all, and is not working. I thought like it should work basically the same as capacitor:

\$\frac{dI_a}{dt} = \frac{V_m*SW1 - \frac{I_a}{R_a}}{L_a}\$

It kind of creates knee on current graph(when i close switch) - follow the red arrow on following screenshot: enter image description here

Green knee is ok, its just due to Iin set to zero via heaviside function somewhere else in program, sorry for it, just distracts.

But for red I feel that desired behaviour should be like sinc stuff, so what was expected is like this, because it has some L: enter image description here

So.. Could you correct me? Or, how to write correct formulas, describing processes in this circuit?


For the curious, its real-world warm-lamp doomsday device. It connects directly to the mains through series lamp, its very dangerous, so you should not do this at home: It has +310VDC on a thyristor radiator..

enter image description here

  • \$\begingroup\$ What does "ODE" stand for? \$\endgroup\$
    – Transistor
    Apr 30, 2019 at 17:55
  • \$\begingroup\$ @Transistor Ordinary differential equation \$\endgroup\$
    – xakepp35
    Apr 30, 2019 at 17:59
  • \$\begingroup\$ Thanks. By the way, when you use the CircuitLab button on the editor toolbar an editable schematic is saved in your post. That makes it easy for us to copy and edit in our answers. You don't need a CircuitLab account, no screengrabs, no image uploads, no background grid. \$\endgroup\$
    – Transistor
    Apr 30, 2019 at 18:03
  • 1
    \$\begingroup\$ Your 2nd part shudbe \$\frac{dI_a}{dt} = \frac{V_m*SW1-I_a \cdot R_a}{L_a}\$ \$\endgroup\$ Apr 30, 2019 at 19:17
  • 1
    \$\begingroup\$ @SunnyskyguyEE75 wut. Since when could we use MathJax in the comments? \$\endgroup\$
    – DKNguyen
    Apr 30, 2019 at 19:44

1 Answer 1


Managed to get that up and running: http://jsfiddle.net/zo2xuhds/embedded/result/

Trick was in a wrong gate logic. A gate must:

  • transfer power in one direction, from capacitor to inductor, but not vice versa (not sure if there are real-world analogs, maybe triac?..)
  • open when a capacitor absolute voltage exceeds some threshold Vopen (no matter negative or positive),
  • close when current will become less than holding current Ihold (again, no matter of its sign)

@SunnyskyguyEE75 mentioned mistake in inductor ODE: Indeed, the Ia⋅Ra is correct term. I've messed resistances up with conductances, which are typically used in neuronal studies.

Certainly, what was noticed during my home-made research, is that:

  • Cm(membrane capacitance) and La(axon inductance) are responsive for frequency ranges and may be chosen low and even fixed.
  • timestep dt(=1) and cap leakage Gm(=1/Rm) are rarely useful and could almost be omitted from model.
  • Ra and Vopen are capable of producing chaotic behaviours, and different kinds of tonic bursts: enter image description hereenter image description hereenter image description here

Such a simple thing is capable of creating non-linear pwm signals

Very pleased with it, I've finally done that, without using exponentials, and even squaring. Probably that puts some restrictions on the model's computational power, but I haven't figured out them yet.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.