Direct Current and Transient Analysis 159
Example 2.16
Create the script fi le current_voltage that returns the currents I 1 , I 2 , I 3 , I 4 , I 5 , I 6 , I 7 , I 8 , and
the voltage Vab shown in the circuit diagram of Figure 2.59 (used in Figure 2.54), given
the fact that the current I = 3 A through the 7 Ω resistor.
MATLAB Solution
% Script file: current _ voltage
clear;clc;
I = 3;
Vyb = 3*5; % from Figure 2.54a
Vxb = 12*3; % from Figure 2.54b
I1 = Vyb/15;
I2 = Vyb/10;
I3 = Vyb/30;
I8 = Vxb/6; % from Figure 2.54c
I4 = (4/16)*I8; % current divider
I5 = (12/16)*I8;
I6 = I8/2;
I7 = I6;
Vab = (I+I8)*5; % from Figure 2.54e
result = [I1 I2 I3 I4 I5 I6 I7 I8];
disp(‘**********************************’);
disp(‘**********R E S U L T S**********’);
disp(‘**********************************’);
disp(‘ ‘);
disp(‘ The currents I1 I2 I3 I4 I5 I6 I7 and I8 (in amps) are given by:’);
disp(result’);
disp(‘*********************************’);
disp(‘The voltage Vab is:’); disp(Vab); disp(‘volts’)
disp(‘*********************************’);
FIGURE 2.59
Network of Example 2.16.
15 Ω
7 Ω
12 Ω
1 Ω
X
4 Ω 6 Ω
4 Ω
a b
Y
2 Ω
I 1
I 2
I 3
I 7
I 6
I 5
I 4
I = 3 A
10 Ω
30 Ω
I 8