MathMath

Help › Functions

Circuits

nodeVoltages branchCurrents

nodeVoltages(N, [f]) MathMath’s own

The voltage at each node of a circuit described by a netlist N, at DC or at a frequency f.

A netlist is a matrix with a row for each part: its name in quotes, its two nodes and its value, as "R1", 1, 2, 10·kΩ. The name's first letter says what the part is: R resistor, C capacitor, L inductor, V voltage source, I current source, O ideal op-amp. An op-amp's row holds its + input, − input and output nodes in place of the nodes and value.

Node 0 is ground. The other nodes are numbered 1, 2, … with none missing. The result lists every node from node 0, so element k is node k's voltage whatever ORIGIN is.

At DC, with no f or f = 0, capacitors are open and inductors are shorts. At f, sources are phasors at that frequency, so a source's value can be complex, as phasor(1·V, 45·deg).

Branch currents come from branchCurrents.

Units

Values can carry units (Ω, F, H, V, A) or be plain numbers in those units. f is in Hz or a plain number of hertz. The voltages are in volts when the netlist has units.

Refused

  • A node with no path to ground at this frequency, whose voltage isn't fixed.
  • A loop of voltage sources (inductors count, at DC), whose voltages can't all hold.
  • An op-amp without feedback, or parts that cancel, leaving no single solution.
  • Missing node numbers, no node 0, a name that doesn't start with one of the letters, or a value in the wrong units.
N≔⎝⎛​”V1””R1””R2”​112​020​5⋅V1⋅kΩ4⋅kΩ​⎠⎞​
nodeVoltages(N)=⎝⎛​054​⎠⎞​ V

branchCurrents(N, [f]) MathMath’s own

The current through each part of a netlist N, in the netlist's order, at DC or at a frequency f.

Each current flows from the part's first node to its second, through the part. So a source supplying power shows a negative current: its current flows out of its first node, against the direction counted.

An op-amp's current is the current it drives out of its output.

The netlist is as for nodeVoltages.

Units

In amperes when the netlist has units.

Refused

N≔⎝⎛​”V1””R1””R2”​112​020​5⋅V1⋅kΩ4⋅kΩ​⎠⎞​
branchCurrents(N)=⎝⎛​−1×10−31×10−31×10−3​⎠⎞​ A