Here is the schematic and the values given. This is for a Coursera test on Linear Circuits I am taking and where I am stuck :-(

enter image description here enter image description here

Doing KCL and KVLs I get this:

$$ \frac{V_a-V_b}{R_1}=I_1+i_B\\ i_A+I_B=I_2\\ -I_2+\frac{V_a-V_b}{R_1}+\frac{V_b}{R_3}+\frac{V_1-V_b}{R_2}=0\\ -V_1+(i_B+i_C)*R_2+(i_D+i_C)*R_3=0\\ \frac{V_b}{R_3}=i_D+i_C\\ \frac{V_1-V_b}{R_2}=i_B+i_C $$ and with iD=I1 $$ V_a-V_B-i_a*R_1=R_1*I_1\\ i_a+I_B=I_2\\ V_A*\frac{1}{R_1}+V_B*(\frac{-1}{R_1}+\frac{1}{R_3}-\frac{1}{R_2})=I_2-\frac{V_1}{R_2}\\ R_2*i_B+i_C*(R_2+R_3)=V_1-I_1*R_3\\ V_B-R_3*i_C=R_3*I_1 $$

This gives this matrix A*X=B with this solution in Matlab

I1=10*1e-3; I2=30*1e-3; V1=10; R1=800; R2=100; R3=300; R4=1000;

A=[1 -1 -R1 0 0; 0 0 1 1 0; 1/R1 (-1/R1+1/R3-1/R2) 0 0 0; ...
    0 0 0 R2 (R2+R3);  0 1 0 0 -R3]
B=[R1*I1; I2; I2-V1/R2; V1-R1*I1; R3*I1]



X =

 -103.5000  Va
   -7.5000  Vb
   -0.1300  iA
    0.1600  iB
   -0.0350  iC

Which unfortunately is wrong :-(

Where is my mistake? What am I doing wrong?

This seems such an easy circuit...


  • \$\begingroup\$ In the third formula Vb/R3 must have a negative sign \$\endgroup\$
    – Dorian
    Sep 18, 2018 at 9:52
  • \$\begingroup\$ Thanks. From a logical standpoint you are right. The current flows in the opposite direction. Unfortunately now it gets even worse and I get this warning: "Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.729154e-23." So I suspect there must be more than this one error (or the problem value are wrong - always a possibility too) \$\endgroup\$
    – Andreas K.
    Sep 18, 2018 at 9:59
  • \$\begingroup\$ In first formula it should be I1+Ia not I1+Ib \$\endgroup\$
    – Rokta
    Sep 18, 2018 at 10:55
  • \$\begingroup\$ Thanks. That's right. Unfortunately this only seems to be a typo as in the following equation I used iA. \$\endgroup\$
    – Andreas K.
    Sep 18, 2018 at 12:23

2 Answers 2


Since you've provided your own work (thanks!), here's how I'd approach the problem. You can weed through your own work, looking over mine, for your own errors. I want to leave something for you to do; that, plus some algebra work I'll also later leave for you, below.

I'm going to always start my loops (all four) from the central node of your schematic. And I will also always follow the direction of your own arrows, as I generate each equation below. And, just to be complete, I will always start each equation with an explicit \$0\:\text{V}\$. The indicated circuit ground is simply ignored for the following purposes:

$$\begin{align*} 0\:\text{V}+V_{I_2}-I_A\cdot R_4-\left(I_A+I_D\right)\cdot R_1&=0\:\text{V}\\\\ 0\:\text{V}+V_{I_2}-\left(I_B+I_C\right)\cdot R_2&=0\:\text{V}\\\\ 0\:\text{V}-\left(I_C+I_D\right)\cdot R_3+V_1-\left(I_C+I_B\right)\cdot R_2&=0\:\text{V}\\\\ 0\:\text{V}-\left(I_C+I_D\right)\cdot R_3+V_{I_1}-\left(I_A+I_D\right)\cdot R_1&=0\:\text{V}\\\\ I_1&=I_D\\\\ I_2&=I_A+I_B \end{align*}$$

You can either use the last two equations to substitute back into the earlier four equations and then solve for four unknown variables in four equations or else you can simply solve the above all six equations for six unknown variables. Either way works fine.

Note that I did not bother to worry about node voltages, but instead used \$V_{I_1}\$ and \$V_{I_2}\$ to represent the voltages across your two current sources.

I'm not going to bother placing the above equations into matrix form for you. It's just algebraic manipulation and I'm sure you could handle that without difficulty.

It's also left to you as an exercise.

So just let Sage provide the direct results:

sage: var('i1 i2 ia ib ic id r1 r2 r3 r4 v1 vi1 vi2')
(i1, i2, ia, ib, ic, id, r1, r2, r3, r4, v1, vi1, vi2)
sage: e1=Eq(vi2-ia*r4-(ia+id)*r1,0)
sage: e2=Eq(vi2-(ib+ic)*r2,0)
sage: e3=Eq(-(ic+id)*r3+v1-(ic+ib)*r2,0)
sage: e4=Eq(-(ic+id)*r3+vi1-(id+ia)*r1,0)
sage: e5=Eq(i2,ia+ib)
sage: e6=Eq(i1,id)
sage: ans=solve([e1,e2,e3,e4,e5,e6],[ia,ib,ic,id,vi1,vi2])
sage: ans[ia].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})
sage: ans[ib].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})
sage: ans[ic].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})
sage: ans[id].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})
sage: ans[vi1].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})
sage: ans[vi2].subs({i1:10e-3,i2:30e-3,v1:10,r1:800,r2:100,r3:300,r4:1000})

Those results will be correct, I believe. I just ran it in Spice, only after doing the above, and it produced the same figures.

LTSpice netlist:

R1 N003 N002 800
R2 N001 N003 100
R3 N003 0 300
R4 N001 N002 1k
V1 N001 0 10
I1 0 N002 10m
I2 N003 N001 30m

enter image description here

  • \$\begingroup\$ Thank you very much. That's way more than I wished for. And I am happy to have a different take on this problem. I'll compare your way and try to figure out my errors. The biggest problem in distance learning like Coursera is the lack of direct communication with fellow "problem solvers" ;-) Btw, do you mind to send me your Spice model for reference. I'll try to put up mine in LTSpice and then can compare it with yours? \$\endgroup\$
    – Andreas K.
    Sep 18, 2018 at 12:30
  • \$\begingroup\$ @AndreasK. Added at the end. \$\endgroup\$
    – jonk
    Sep 18, 2018 at 12:34
  • 1
    \$\begingroup\$ To the person providing a (-1) rating, have the courage to identify yourself and your reasoning. Cowardice isn't a virtue. \$\endgroup\$
    – jonk
    Sep 18, 2018 at 14:31
  • \$\begingroup\$ @jonk I'm afraid such words are useless since those people will not only take advantage of the anonymity of the action, but also take it further in the meta (maybe not even EE meta). I don't have the link, anymore, but I know there was a very animated thread about this, with (perhaps) not surprisingly quite evenly split opinions. \$\endgroup\$ Sep 19, 2018 at 6:39
  • \$\begingroup\$ @aconcernedcitizen I have no control over anyone. Just offering my opinion. Of course, everyone is free to act as they choose. \$\endgroup\$
    – jonk
    Sep 19, 2018 at 6:43

I would use nodal analysis at for VA and VB utilizing Kirchhoff's Current Law (KCL). First, solve for the voltages, and then use the voltages to solve for the currents. Remember that all the currents going into a node equals the amount of current leaving a node, and since the elements are resistors, you can just use V=IR to get the current of a resistor. Using nodal analysis, you should have two equations with two unknowns, making it easier to work with than mesh analysis and the multiple currents. Once you have the voltages, it should be fairly simple to solve for the currents through the resistors.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.