Symbolic Circuit Simulation | |

V=I*RSolve for I. This turns out to be a general problem in simulation, that is, get the currents on the right side of the equation to sit over to the left by themselves.

In using Maxima, I always like to use variables with three-letter names. This makes things easier to work on in the long run. So the above problem in Maxima looks like this:

(C1)I typed in the parts that are in bold, the rest is Maxima.vin=iin*rin;(D1) vin = iin rin (C2)solve([D1],[iin]);vin (D2) [iin = ---] rin

I have found that it is easier to use Maxima if I avoid using the equals sign. This is easy to do, because the solve() function assumes that the expressions without and equals sign is actually an equation that is implicitly equal to zero. So I prefer it this way:

(C1)Here's a voltage divider:vin-iin*rin;(D1) vin - iin rin (C2)solve([D1],[iin]);vin (D2) [iin = ---] rin

(C1)This set of equations has two Ohm's law equations, two unkowns (iin and vout), and three knowns (vin, rin, and rsh). I always start with a little table like this:vin-vout-iin*rin;(D1) - vout + vin - iin rin (C2)vout-iin*rsh;(D2) vout - iin rsh (C3)solve([D1,D2],[iin,vout]);vin rsh vin (D3) [[iin = ---------, vout = ---------]] rsh + rin rsh + rin

Knowns |
Unknowns |
Equations(implicit = 0) |
Typeof Equation |

rin | iin | vin-vout-iin*rin; | Ohm's Law |

rsh | vout | vout-iin*rsh; | Ohm's Law |

vin |

The networks can get quite large, and they can have many different types of components, such as opamps, transistors, and reactive components. The danger of this approach is that you get very large solutions to the equations, and you wonder, 'What am I going to do with this huge symbolic solution?' These are called wallpaper functions, because the only thing they are good for is printing out and using as wallpaper. Actually, there are nice things that you can do to tame wallpaper functions and make them useful:

- Differentiate to find sensitivities. An example is a circuit that has many inputs and one output. By differentiating the expression for the output with respect to the different inputs, the transfer function from input to output can be calculated.
- Differentiate to find an optimal value. If a circuit has a function that describes optimum operation, differentiate this function, set it equal to zero, and solve for the optimum value.
- Turn the solutions around to derive component values from the desired behavior of the circuit
- Plug the equations into a computer program, where they are used like a simulator that you can call as a subroutine.
- Put the equations into a spreadsheet, and adjust component parameters to get the desired circuit operation.

**More later!**
Meanwhile, Download
Maxima and try it out!

**Future Sections**

More about the divider, KCL, and the vout node.

A larger circuit

reactive components, tank circuit with capacitive coupling.

optimization

sensitivity analysis

automation of equation generation

comparison with numerical simulation for results and performance

Copyright (C) 2003 by Tom Anderson. All Rights Reserved.