ECE 2100 UH
Mathematica code(c) for Lab2-Advanced - circuit 2A
                                                             Han Q. Le - University of Houston (copyrighted)

Back to Lab 2      download .nb file here (c)   


There are two sections, solving exactly the same problem. Section One uses KVL (fewer equations), Section Two uses KCL (more equations). To execute the code. Just select the whole section, hit Shift+Enter.

1. KVL: Mesh Current Method (go to the next section for the Node Voltage Method)

In[263]:=

code_for_lab2_circuit2A_1.gif

code_for_lab2_circuit2A_2.gif
code_for_lab2_circuit2A_3.gif code_for_lab2_circuit2A_4.gif code_for_lab2_circuit2A_5.gif
mesh 1 mesh 2 mesh 3
i1 (mA) i2 (mA) i3 (mA)
23.571 13.673 4.468
vsource -12.000
R1 1.108
LED1 2.049
R2 2.673
R3 2.292
LED2 3.878
LED3 1.904
R4 0.643
LED4 2.175
R2 -2.673
LED1 -2.049
LED4 -2.175
R5 4.468
R3 -2.292
code_for_lab2_circuit2A_6.png code_for_lab2_circuit2A_7.png code_for_lab2_circuit2A_8.png

# FindRoot iterations:      2
time for calculation:    0.0270000 sec  (excluding graphics display)

2. KCL : Node Voltage Method (go to the top section for the Mesh Current Method)

code_for_lab2_circuit2A_9.gif

code_for_lab2_circuit2A_10.gif
code_for_lab2_circuit2A_11.gif code_for_lab2_circuit2A_12.gif code_for_lab2_circuit2A_13.gif
node A node B node C node D
vA (V) vB (V) vC (V) vD (V)
10.892 6.170 8.345 3.878
code_for_lab2_circuit2A_14.png -23.571
code_for_lab2_circuit2A_15.png 9.899
code_for_lab2_circuit2A_16.png 13.673
code_for_lab2_circuit2A_17.png -9.899
code_for_lab2_circuit2A_18.png -9.205
code_for_lab2_circuit2A_19.png 19.104
code_for_lab2_circuit2A_20.png -13.673
code_for_lab2_circuit2A_21.png 9.205
code_for_lab2_circuit2A_22.png 4.468
code_for_lab2_circuit2A_23.png -19.104
code_for_lab2_circuit2A_24.png -4.468
code_for_lab2_circuit2A_25.png 23.571
code_for_lab2_circuit2A_26.png code_for_lab2_circuit2A_27.png code_for_lab2_circuit2A_28.png code_for_lab2_circuit2A_29.png
mesh 1 mesh 2 mesh 3
i1 (mA) i2 (mA) i3 (mA)
23.571 13.673 4.468
vsource -12.000
R1 1.108
LED1 2.049
R2 2.673
R3 2.292
LED2 3.878
LED3 1.904
R4 0.643
LED4 2.175
R2 -2.673
LED1 -2.049
LED4 -2.175
R5 4.468
R3 -2.292
0. 0. 0.
# FindRoot iterations:      1
time for calculation:    0.0200000 sec  (excluding graphics display)
Back to Lab 2      download .nb file here (c)   



Created with the Wolfram Language