Numerical integral/derivative of expressino

Hi,

On occasion I would like to take the derivative or integral of an expression. For example, I might take do a DC sweep of a feedback-based amplifier circuit, take the absolute gain -V(OUT)/V(IN), and want to take the derivative of that to look at the gain linearity of the circuit over a particular input/output voltage swing. It would be nice to be able to enter that as an expression to plot in a simulation.

I do not believe integral/derivative functions exist at the moment based on the Expressions documentation. Any possibility of adding this? I'd imagine a first- or second-order numerical approximation (forward difference,or two-point center difference; trapezoidal or Simpson's integral) would be adequate for CircuitLab.

Regards, Laogeodritt

by Laogeodritt
April 17, 2015

So CircuitLab has laplace blocks that will numerical intergrate signals. look up Laplace transforms. Here is an example: PIC and the intergrating results: PIC

I could not get the derivative to work correctly, it was changing as I changed the time step so that needs work.

by Garrett
April 19, 2015

Good idea from Garrett.

However, this only works in the simulation itself. The Laplace blocks cannot be used to post process plot data in the way that the integral and derivative functions of the spice .measure statements can be used to work on plot data after a simulation has been run.

There are also some things to be wary of in using CL's Laplace block to form a pure 1/s integrator. There's some background here:

https://www.circuitlab.com/forums/support/topic/96jc4424/cls-laplace-h_s-block/

:)

by signality
April 19, 2015

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.