# Nodal Analysis - solving 2 variables with 3 equations

There are three conditions:

• before the switch is closed (opened)
• while the switch is closed (closed)
• after the switch is closed (opened)

I think I need to solve them sequentially, because the system has memory.

Here are the system equations (before the switch is closed):

1. $\Large\frac{9+9}{R_6+R_9}+\frac{9-V_d}{R_4}+\frac{9-V_c}{R_1}=0$

2. $\Large\frac{V_d-9}{R_4}+\frac{V_d-V_c}{R_8}+\frac{V_d}{R_5}+\frac{V_d-V_d⋅{(1-e^{-\frac t{R_7⋅C_2}})}}{R_7}=0$

3. $\Large\frac{V_c-9}{R_1}+\frac{V_c-V_d}{R_8}+\frac{V_c}{R_2}+\frac{V_c-V_c⋅{(1-e^{-\frac t{R_3⋅C_1}})}}{R_3}=0$

Also, the current flow of $V2$ before the switch is closed is meaningless; if I try to cut the wire between $V2$ and node $a$ to see the graph before and after, it won't alter $V_c$ and $V_d$. So it is meaningless. That's why I'm not including this current flow in the equation number 1 above. Edit: Sorry, it did alter, but for a tiny amount

Some strange things happened after plugging in the $R$ values. When I use Microsoft Mathematics to solve equations $2$ and $3$, I get the correct graph, but if I try to solve the equation $2$ with $1$, or $3$ with $1$, I get the wrong graph. What's wrong?

• Your equations use Vd and Vc, but your schematic shows V1 and V2. You need to fix this discrepancy. Nov 9, 2017 at 10:47
• My mistake. I see that now. Nov 9, 2017 at 10:52
• Looks good. Nice question. +1 Nov 9, 2017 at 10:56
• Maybe a better use is to avoid the use of a PWL and use a .STEP command with a resistor instead of the switch, having the values 1m and 1g (note the smaller difference between the orders of magnitude, something which may cause hiccups). This is because the capacitor may need to reach a steady state which will make comparisons more difficult. Plotting a .step'ed quantity will let you analyse them in parallel. In this case, startup will not be needed, LTspice would automatically determine the operation point. Nov 11, 2017 at 8:03
• You are needlessly exaggerating those values. The the simulator uses the computer as the underlying hardware so it's prone to the same limitations. What's more, LTspice uses float, instead of double (unless .opt numdgt=8, or greater), for speed. Using such great differences between values is also discouraged by the manual, not to mention common sense. What values do you think those get to be converted into during the simulation? 1m is << than the kOhms you have, and 1g is >> than the kOhms, you won't feel any difference, and LTspice will happily simulate it, correctly. Nov 11, 2017 at 19:28