Is this a numerical error or just how math works? (integral(rollingaverage(x)) very different from i...
l
Is this a numerical error or just how math works? (integral(rollingaverage(x)) very different from integral(x))
Hmm ravg(integ(x)) also very different so I'm pretty sure it's floating point stuff not how math actually works. Not a bug I think...
raw file if of use
oh it's probably me misunderstanding how ravg() or integ() work cuz if I scroll the x axis right slightly then the plots all look the same
s
@Luke Harold Miles For low current values there are numerical oscillations in simulations. Add this:
.options method=gear
this uses a higher order differential equation solver that avoids these artifacts.
🙌 1
@Luke Harold Miles integration and ravg() are done on the interval shown in the graph.
Also do not expect numerical simulations to show reliable data in the Femto-Coulomb range, unless -may be- you tune the precision parameters of the simulator, and set the above method=gear parameter (and cross fingers)
👍 1
If you integrate a current of a nA over 100ns you get 1e-16C of charge , ~600 electrons. Too low for a concentrated parameters circuit solver.
👍 1
And this is the numerical oscillation of the i(vmt2) voltage source: zoom in into the waveform you will see it.
👍 1
l
Thank you very much. This knowledge is very valuable to me. I am still newbing along 😅
@Stefan Schippers how much charge for the numbers to be somewhat trustworthy? 10^-15C? 10^-14C? (Assuming a very reasonable and simple circuit.)
If you integrate a current of a nA over 100ns you get 1e-16C of charge , ~600 electrons. Too low for a concentrated parameters circuit solver.
s
Difficult to give a number, Charge conservation also depends on length of simulation. A very long transient simulation with millions of integration timesteps will accumulate considerable charge errors due to numerical approximations. I can't give you a number, but I often have seen charge conservation violations in simulations.