Inductors, Capacitors and Op-Amps

This document describes an algorithmic method for generating modified nodal analysis (MNA) equations when the circuit has inductors, capacitors and/or operational amplifiers (op-amps). It consists of several parts:.

- MNA with reactive elements
- MNA with and op amps.
- SCAM - A MATLAB® tool for deriving and solving circuit equations symbolically (Symbolic Circuit Analysis in MatLab).

Applying modified nodal analysis to circuits with inductors and capacitors presents no special difficulty if one uses the complex impedance of these elements.

Let us apply MNA to the following circuit (which already has nodes labeled, and the current through the voltage source defined and labeled):

MNA will generate 4 equations, one for each of the three nodes, and one for Vin. By inspection we get:

Using the MNA algorithm we get:

Since the matrices are all defined, we can finish the solution:

Careful inspection of this result verifies that it is identical to the original result. Don't worry about solving this equation; a later page will introduce SCAM - A MATLAB tool for deriving and solving circuit equations symbolically.

Applying modified nodal analysis to circuits with ideal operational amplifiers (op- amps) is a bit more difficult. Each op-amp increases the count of voltage sources by 1 (because the output of an op amp is treated as a voltage source), but also complicates the creation of the MNA matrices. In particular, the

BandCmatrices are no longer transposes of each other. To see how the ideal operational amplifier is handled, consider the circuit below:Note that we have labelled all of the nodes, and defined a current through each voltage source. The current through the voltage source Vs is I_Vs, and the voltage into the op-amp is labeled I_OA. We will make the standard assumption for an ideal op-amp. Namely that there is no current into the device at either input to the op-amp, and the voltage difference between the inputs is zero (note caveats below).

This circuit will require 6 equations -- one each for the 4 nodes and one each for the 2 labeled currents. We can now write the circuit equations by inspection.

or in matrix form:

The only difference between this equation and the others that we have developed is that the equation for the op-amp is not in terms of the voltage at its output, but rather it specifies that the two input terminals are at the same potential.

## Changes to formation of the MNA matrices.

The

Amatrix:Recall that the

Amatrix is formed of four smaller matrices,G,B,C, andD.

The rule for the

Gmatrix is unchanged.The rule for the

Bmatrix is unchanged -- the op-amp is treated as another voltage source.The rule for the

Cmatrix does change. TheCmatrix is annxmmatrix with only 0, 1 and -1 elements. Each location in the matrix corresponds to a particular node (first dimension) or voltage source (second dimension). For each indendent voltage source, if the positive terminal of theith voltage source is connected to nodek, then the element (k,i) in theCmatrix is a 1; if the negative terminal of theith voltage source is connected to nodek, then the element (k,i) in theCmatrix is a -1. For each op-amp let the positive input terminal be at nodekand negative terminal at nodej; the corresponding (ith) row of the C matrix has a 1 at location corresponding to the positive terminal (k,i), and a -1 at the location corresponding to the negative terminal (j,i). Otherwise, elements of theCmatrix are zero.The rule for the

Dmatrix is unchanged.The

xmatrix is unchanged.The

zmatrix:Recall that the

zmatrix is formed of two smaller matrices,iande.

The rule for the

imatrix is unchanges.The rule for the

ematrix does change. Theematrix is an 1xmmatrix with each element of the matrix corresponding to a voltage source. If the element in theematrix corresponds to an independent source it is set equal to the value of that voltage source. If the element corresponds to an op-amp, then its value is set to zero.All of the MNA rules for use with circuits with op-amps are here.

**Caveats:** The two ideal op-amp assumptions
(no input current, no potential difference at inputs) only hold for circuits
with negative feedback. Because of this, the MNA method as applied here
can give erroneous results if negative feedback is not present. This
problem actually persists in many commercial circuit simulators -- you can hook
up a circuit with the input terminals reversed (so that it would not operate
properly in practice due to lack of negative feedback) and the simulation
behaves as if there is no problem. Note also that the output of the op-amp
is not limited by any power supply -- this circuit will happily generate
hundreds of volts.

Also: the op-amp rule can be simplified by taking advantage of
the redundancy in node voltages since the two input nodes are at the same
voltage. Taking advantage of this fact reduces the number of equations by
1, though it makes the generation of the equations a bit more difficult (The
diagonal of the **G** matrix can have negative values, the off-diagonal
element elements can be positive, the **C** matrix can have values besides 1,
-1 and 0 and the **D** matrix is non-zero). See Litovski
for details.

Let's apply the algorithm to the circuit at hand:

Using the rules for the algorithm we get:

This result, upon inspection, is identical to our previous result.

Let's look at another simple example just to reinforce the concepts.

This circuit will require just 3 equations (2 nodes, 1 voltage sources). By inspection we get:

Using our MNA algorithm we get:

We can now use these matrices to solve the circuit:

which agrees with our previous result.

The next document describes SCAM,
a MATLAB
program that performs all of these manipulations to set up the matrices, and
then *solves* the circuit.