CircuitLab gives you the ability to create and edit custom mathematical expressions to explore interesting things about your circuit. Expressions can be used in the output boxes for all simulation types. The simplest expressions are populated by CircuitLab by clicking on a node or a circuit terminal while a simulation box is visible (see plotting outputs).

Clicking on a node or wire to plot will create the expression

V(NAME)which will plot the voltage at node NAME.

Clicking on an circuit terminal will create the expression

I(NAME.TERMINAL)which will plot the current going into the TERMINAL of element NAME.

*
(Note: the current relative to a terminal is always defined as positive
going into that terminal. To plot the current going out
of a terminal, edit the expression to have a minus sign in front!)
*

Expressions support the basic mathematical expressions +,-,*, and /. For example, to plot the difference between the voltage a node named V_Plus and the voltage at a node named V_Minus, do:

V(V_Plus)-V(V_Minus)

Other powerful expressions include the ability to measure power dissipation, such as

P(Q1)to compute the power dissipated in transistor Q1.

A complete description of supported expressions is below:

Operator | Description | Contexts* |
---|---|---|

+ | Addition | ABCD |

- | Subtraction | ABCD |

* | Multiplication | ABCD |

/ | Division | ABCD |

^ or POW(x,n) | Exponentiation | ABCD |

< | 1 if x < y; 0 otherwise | ABCD |

> | 1 if x > y; 0 otherwise | ABCD |

ABS(x) | Absolute value of x | ABCD |

ACOS(x) | Inverse cosine of x | ABCD |

ACOSH(x) | Inverse hyperbolic cosine of x | ABCD |

ASIN(x) | Inverse sine of x | ABCD |

ASINH(x) | Inverse hyperbolicsine of x | ABCD |

ATAN(x) | Inverse tangent of x | ABCD |

ATANH(x) | Inverse hyperbolic tangent of x | ABCD |

CONJ(x) | Complex conjugate of number x | __C_ |

COS(x) | Cosine of x | ABCD |

COSH(x) | Hyperbolic cosine of x | ABCD |

DB(x) | Number x in decibels. In the case where x has units of power (Watts), the DB() operator does 10*LOG(x). In all other cases it does 20*LOG(x). | ABCD |

EXP(x) | Exponential function | ABCD |

I(NAME.TERMINAL) | Current into TERMINAL of element NAME | _BCD |

IF(t, x, y) | x if t > 0; y otherwise | ABCD |

IMAG(x) | Imaginary part of complex number x | __C_ |

LIMIT(a, x, y) | a, bounded by lower limit x and upper limit y | ABCD |

LN(x) | Natural logarithm of x | ABCD |

LOG(x) | Base 10 logarithm of x | ABCD |

MAG(x) | Magnitude of complex number x | __C_ |

MAX(x, y) | The more positive of x and y | ABCD |

MIN(x, y) | The more negative of x and y | ABCD |

P(NAME) | Power dissipated in circuit element NAME | _BC_ |

PH(x) | Phase of complex number x in radians | __C_ |

PHDEG(x) | Phase of complex number x in degrees | __C_ |

PWL(t_{1},x_{1},t_{2},x_{2},...) | Piece-wise linear signal with value x_{1} at t=t_{1}, and so on, with linear interpolation between points. If t_{1} is not 0, then the point 0,0 is implied. All t_{1}...t_{n} must be in ascending order. All t_{n} and x_{n} must be fixed values -- they can not contain further computation. | _BCD |

PWLREPEAT(t_{1},x_{1},t_{2},x_{2},...) | Like PWL, but repeats indefinitely. The signal to be repeated spans from t=0 to the final specified time point. | _BCD |

PWS(t_{1},x_{1},t_{2},x_{2},...) | Piece-wise step signal with value x_{1} at t=t_{1}, and so on, changing in stepwise fashion at each timestep. If t_{1} is not 0, then the point 0,0 is implied. All t_{1}...t_{n} must be in ascending order. All t_{n} and x_{n} must be fixed values -- they can not contain further computation. | _BCD |

PWSREPEAT(t_{1},x_{1},t_{2},x_{2},...) | Like PWS, but repeats indefinitely. The signal to be repeated spans from t=0 to the final specified time point. | _BCD |

REAL(x) | Real part of complex number x | __C_ |

SIN(x) | Sine of x | ABCD |

SINH(x) | Hyperbolic sine of x | ABCD |

SQRT(x) | Square root of x | ABCD |

TAN(x) | Tangent of x | ABCD |

TANH(x) | Hyperbolic tangent of x | ABCD |

UNITLESS(x) | Remove units from real quantity x | _BC_ |

URAMP(x) | x if x >= 0; 0 if x < 0 | ABCD |

USTEP(x) | 1 if x >= 0; 0 if x < 0 | ABCD |

V(NODE_NAME) | Voltage at node NODE_NAME | _BCD |

* Contexts: some functions are only applicable in certain modes of CircuitLab operation:

- A: Statically-evaluated parameters, like in a resistor's resistance value.
- B: Plotting expressions in real analysis modes, such as DC Sweep, and Time-domain simulation. Expressions to evaluate for DC simulation.
- C: Plotting expressions in complex analysis modes, such as Frequency-domain simulation.
- D: Behavioral voltage and current expressions to be evaluated for arbitrary behavioral voltage and currents.

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