Skip to main content

Using Expressions for Component Values

Tscircuit lets you use normal JavaScript expressions to calculate component values. This is useful when a part's value depends on other parameters, like setting a voltage divider's output or picking the capacitor for an LC resonant circuit.

Voltage divider

Here we pick R2 so that a divider powered from vin produces vout. Changing any of the parameters automatically recomputes R2.

Schematic Circuit Preview

LC resonant circuit

The resonant frequency of an LC tank is f = 1/(2π√(LC)). Knowing the desired frequency and an inductance, we can compute the required capacitance.

Schematic Circuit Preview

These examples show how expressions make it easy to drive component values from formulas so designs can adapt when requirements change.