**An Electrical-Resistance Network**

The circuit shown in Figure 6.2-1 has five resistances and two applied voltages. Assuming that the positive directions of current flow are in the directions shown in the figure, Kirchhoff’s voltage law applied to each loop in the circuit gives

-VI + Rii, + R4i4 = 0

-R4i4 + R2i2 + R5i5 = 0

-R5iS + R3i) + V2 = 0

Conservation of charge applied at each node in the circuit gives

II = ii +i4

i: = i) + is

You can use these two equations to eliminate i4 and is from the first three equations. The

result is:

(RI,+ R4)i I – R4i2 = VI

-R4il + (R2 + R4 + R5)i2 – R5i3 = 0

R5i21- (RJ + R5)i) = V2

Thus we have three equations in three unknowns: ii, i2, and i).

**An electrical-resistance network.**

Write a MATLAB script file that uses given values of the applied voltages VI and V2 and given values of the five resistances to solve for the currents ii, i2, and i3′ Use the program to find the currents for the case RI = 5, R2 = 100, R3 = 200, R4 = 150, Rs = 250 kn, VI = 100, and V2 = 50 V. (Note that I kn = 1000 n.)

**• Solution**

Because there are as many unknowns as equations, there will be a unique solution if IAI =f: 0; in addition, the left-division method will generate an error message if IAI = O. The following script file, named resist .m,uses the left-division method to solve the three equations for ii, i2, and i3′

% File resist.m ./

% Solves for the currents i_1, i_2, i_3

R = [5,100,200,150,250]*1000;

v1 100; v2 = 50;

A1 [R(1) + R (4), -R (4), 0];

A2 [-R (4), R (2) + R (4 ) + R (5), -R (5) ];

A3 [0, R (5r . – (R(3) + R (5) )];

A = [A1; A2; A3];

b=[v1; 0; v2];

current = A\b;

disp(‘The currents are:’)

disp(current)

The row vectors A1, A2, and A3 were defined to avoid typing the lengthy expression for A in one line. This script is executed from the commandprompt as follows:

»resist

The currents are:

1.0e-003*

0.9544

0.3195

0.0664

Because MATLAB did not generate an error message, the solution i~ unique. The currents are il = 0.9544, i2 = Q.3195, and is = 0.0664 mA, where 1 mA = 1 milliampere =0.00 I A.

### Related Matlab Homework Assignments