Electrical – Solve a circuit with the nodal analysis (1)

analysiscircuit analysis

I have the following circuit…

circuit

…and I want to find Vo with the nodal analysis.

At node 1 (V1):

V1 + 40 + (V1-Vo)/2 + 5 = 0
2V1 + 80 + V1 - Vo + 5 = 0
3V1 - Vo = -85

At node 2 (Vo):

(V1-Vo)/2 + 5 + (Vo+20)/8 + Vo/4 = 0
4V1 - 4Vo + 40 + Vo + 20 + 2Vo = 0
4V1 - Vo = -60
Vo = 4V1 + 60

Then V1:

3V1 - 4V1 - 60 = -85
V1 = 25 V

And Vo:

Vo = 4V1 + 60 = 4*25 + 60 = 160 V

But something is wrong, because the solution is Vo = 27.27 V (source).

Best Answer

Seems like it is hard to keep the directions consistent. I find that it is always useful to keep the following picture in my mind:

Wikipedia entry

and from this, if the unit is a resistor: $$ i = \frac{v_{+} - v_{-}}{R}. $$

Decide if you want to use current into or out of each node. I usually prefer out of, which means that the voltage at the node is always the first term (\$v_{+}\$). This gives: $$ \frac{\color{red}{v_1}-40}{1} + \frac{\color{red}{v_1}-v_2}{2} + 5 = 0, \\ \frac{\color{green}{v_2}-v_1}{2} + \frac{\color{green}{v_2}-0}{4} + \frac{\color{green}{v_2}-(-20)}{8}-5=0, $$ This is easily solved. You could use a calculator or a math program, or you could do it by hand, for instance by multiplying the first equation by 2 and the second by 8: $$ \begin{eqnarray} 2v_1-80+v_1-v2+10 = 0\\ 4v_2-4v_1+2v_2+v_2+20-40=0 \end{eqnarray} $$ so $$ \begin{eqnarray} 3v_1 - v_2 - 70 &=& 0, \qquad(1)\\ -4v_1 + 7v_2 - 20 &=& 0, \qquad(2) \end{eqnarray} $$ or $$ \begin{pmatrix}3 & -1\\-4&7\end{pmatrix}\begin{pmatrix}v_1\\v_1\end{pmatrix}=\begin{pmatrix}70\\20\end{pmatrix}, $$ keeping in mind that the determinant is \$3\cdot7-(-1)(-4)=17\$, $$ \begin{pmatrix}v_1\\v_2\end{pmatrix} = \begin{pmatrix}3&-1\\-4&7\end{pmatrix}^{-1}\begin{pmatrix}70\\20\end{pmatrix} = \frac{1}{17}\begin{pmatrix}7&1\\4&3\end{pmatrix}\begin{pmatrix}70\\20\end{pmatrix}=\begin{pmatrix}{30\\20}\end{pmatrix}. $$ So, \$v_o = v_2 = 20 V\$.