Electrical – Node Voltage Method, how to resolve with Voltage and Current sources

voltage

Here is the circuit.

schematic

simulate this circuit – Schematic created using CircuitLab

What I have to do when there are 2 different sources?

Find all the voltages in the resistors.

Supposing every current going out of the nodes, here are the equations:

NODE1) \$V1=-15\$

NODE2) \$V2/R2+(V2-V3)/R3-I1=0\$

NODE3) \$(V3-V1)/R1+(V3-V2)/R3-I2=0\$

-Don't know if the first equation is right, or it has to be:
$$-15+(V1-V3)/R1+I1=0$$
-Don't know what am I supposed to do with the \$V1\$ in the NODE3's equation, using -15 instead of \$V1\$ or simply don't put it. (?)

Considering only the NODE2 and NODE3 equations:
$$G*V=I$$
I have to find \$G^-1\$:
$$G^-1=1/detG*(G^a)^T$$
\$G^a\$ = matrix composed by algebraic complements, \$G^T\$ = transposed.

By doing that I find wrong results.

I know there are many ways to resolve this problem, but I have to practice the node voltage method.
Also it can be that I did some algebra or numbers wrong, I'm trying again meanwhile.

Best Answer

I've added a ground reference to your schematic on the left and then redrew it, on the right:

schematic

simulate this circuit – Schematic created using CircuitLab

You already know \$V_1=+15\:\text{V}\$. That's "free." At this point, you need only quickly write out the other two equations:

$$\begin{align*} \frac{V_2}{R_2}+\frac{V_2}{R_3}&=I_1+\frac{V_3}{R_3}\\\\ \frac{V_3}{R_1}+\frac{V_3}{R_3}&=I_2+\frac{V_1}{R_1}+\frac{V_2}{R_3} \end{align*}$$

I divide up my equations (shown above) using a "mental model" I acquired from reading Spice source code: I place out-flowing currents on the left and in-flowing currents on the right. A current source is either an out-flowing current or else it is an in-flowing current. So I place that on whichever side it belongs, depending on which way it points.

You can re-arrange the above equations per the standard format for matrix solution, if you want.

$$\left[{\begin{array}{cc}\frac{1}{R_2}+\frac{1}{R_3}&\frac{-1}{R_3}\\\frac{-1}{R_3}&\frac{1}{R_2}+\frac{1}{R_3}\end{array}}\right]\left[{\begin{array}{cc}V_2\vphantom{\frac{V_1}{R_3}}\\V_3\vphantom{\frac{1}{R_3}}\end{array}}\right]=\left[{\begin{array}{cc}I_1\vphantom{\frac{V_1}{R_3}}\\I_2+\frac{V_1}{R_1}\vphantom{\frac{1}{R_3}}\end{array}}\right]$$

Now use Cramer's rule, if by hand. Or use Sage/sympy or some other software product, if you prefer. Regardless, the simultaneous solution of the above will produce \$V_2\$ and \$V_3\$ for you.