For the circuit of Fig. 4.5, compute the voltage across each current source.
FIGURE 4.5
The circuit has been redrawn consolidating all the nodes to a minimum number. The resultant circuit is shown below. All the nodal voltages have been marked.
KCL equation at node 1 is:
$$ \begin{aligned} &\frac{v_{1}-v_{2}}{1}+\frac{v_{1}-v_{3}}{2}=-3 \\ &2\left(v_{1}-v_{2}\right)+\left(v_{1}-v_{3}\right)=-6 \\ &3 v_{1}-2 v_{2}-v_{3}=-6 \end{aligned} $$
KCL equation at node 2 is:
$$ \begin{aligned} &\frac{v_{2}-v_{1}}{1}+\frac{v_{2}-v_{3}}{4}+\frac{v_{2}}{3}=0 \\ &12\left(v_{2}-v_{1}\right)+3\left(v_{2}-v_{3}\right)+4\left(v_{2}\right)=0 \\ &-12 v_{1}+19 v_{2}-3 v_{3}=0 \end{aligned} $$
KCL equation at node 3 is:
$$ \begin{aligned} &\frac{v_{3}-v_{1}}{2}+\frac{v_{3}-v_{2}}{4}+\frac{v_{3}}{5}=7 \\ &10\left(v_{3}-v_{1}\right)+5\left(v_{3}-v_{2}\right)+4 v_{3}=140 \\ &-10 v_{1}-5 v_{2}+19 v_{3}=140 \quad \ldots \ldots \cdots \end{aligned} $$
Above equations can be solved by MATLAB
And MATLAB CODE is
$$ \begin{aligned} &>>a=[3-2-1 ;-1219-3 ;-10-519] \\ &>>b=[-6 ; 0 ; 140] \\ &>c=\operatorname{inv}(a)^{*} b \end{aligned} $$
$$ \mathrm{c}= $$
5.2353
\(5.1176\)
\(11.4706\)
So
$$ \begin{aligned} &v_{1}=5.235 \mathrm{~V} \\ &v_{2}=5.1176 \mathrm{~V} \\ &v_{3}=11.47 \mathrm{~V} \end{aligned} $$
Now, voltage across the 3 A current source,
$$ \begin{aligned} &v_{3 A}=v_{1} \\ & v_{3 A}=5.235 \mathrm{~V} \end{aligned} $$
Voltage across the 7A current source,
$$ \begin{aligned} &v_{7 A}=v_{3} \\ & v_{7 A}=11.47 \mathrm{~V} \end{aligned} $$