Jump to content

Linear Algebra and the C Language/a04n

From Wikibooks, open books for an open world


Analysis of an electrical circuit

[edit | edit source]

Studying the circuit in a clockwise direction, we can write:

At node A:

 Input = Output I1 = I2 + I3 

At node B :

 Input = Output I3 = I4 + I5 

At node C:

 Input = Output I2 + I5 = I6 

At node D :

 Input = Output I6 + I4 = I1 

Then:

a) +I1 -I2 -I3 = 0 +I3 -I4 -I5 = 0 +I2 +I5 -I6 = 0 -I1 +I4 +I6 = 0 

Left part of the circuit:

 90 -I2 R2 - I6 R61 = 0 b) -I2 R2 - I6 R6 = -90 

Top right part of the circuit:

 I2 R2 - I3 R3 - I5 R5 = 0 c) I2 R2 - I3 R3 - I5 R5 = 0 

Bottom right part of the circuit:

 I6 R6 + I5 R5 - I4 R4 = 0 d) - I4 R4 + I5 R5 + I6 R6 = 0 

External part of the circuit:

 90 - I3 R3 - I4 R4 = 0 e) - I3 R3 - I4 R4 = -90 

Then:

a) +I1 -I2 -I3 = 0 +I3 -I4 -I5 = 0 +I2 +I5 -I6 = 0 -I1 +I4 +I6 = 0 b) -I2 R2 -I6 R6 = -90 c) +I2 R2 -I3 R3 -I5 R5 = 0 d) -I4 R4 +I5 R5 +I6 R6 = 0 e) -I3 R3 -I4 R4 = -90 

With R2 = 50, R3 = 20, R4 = 50, R5 = 10, R6 = 20

a) +I1 -I2 -I3 = 0 +I3 -I4 -I5 = 0 +I2 +I5 -I6 = 0 -I1 +I4 +I6 = 0 b) -I2 50 -I6 20 = -90 c) +I2 50 -I3 20 -I5 10 = 0 d) -I4 50 +I5 10 +I6 20 = 0 e) -I3 20 -I4 50 = -90 

Let's rectify the system:

 I1 I2 I3 I4 I5 I6 +1 -1 -1 +0 +0 +0 0 0 0 +0 +0 +1 -1 -1 +0 0 0 0 +0 +1 +0 +0 +1 -1 0 0 0 -1 +0 +0 +1 +0 +1 0 0 0 +0 -50 +0 +0 +0 -20 0 0 -90 +0 +50 -20 +0 -10 +0 0 0 0 +0 +0 +0 -50 +10 +20 0 0 0 +0 +0 -20 -50 +0 +0 0 0 -90 

The code in C language:

double ab[RA*(CA+Cb)]={ // I1 I2 I3 I4 I5 I6   +1, -1, -1, +0, +0, +0, 0, 0, 0,  +0, +0, +1, -1, -1, +0, 0, 0, 0,  +0, +1, +0, +0, +1, -1, 0, 0, 0,  -1, +0, +0, +1, +0, +1, 0, 0, 0,  +0, -50, +0, +0, +0, -20, 0, 0, -90,  +0, +50, -20, +0, -10, +0, 0, 0, 0,   +0, +0, +0, -50, +10, +20, 0, 0, 0,  +0, +0, -20, -50, +0, +0, 0, 0, -90, }; 

The solution is given by solving the system:

 I1 I2 I3 I4 I5 I6 +1.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +3.00 +0.00 +1.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +0.00 +0.00 +2.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +0.00 +0.00 +0.00 +1.00 +0.00 +0.00 +2.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 +0.00 I1 = 3, I2 = 1, I3 = 2, I4 = 1, I5 = 1, I6 = 2