CH 04
CH 04
Kirchhoffs current law states that for any electrical circuit, the algebraic sum of all the currents at any node in the circuit equals zero. In nodal analysis, if there are n nodes in a circuit, and we select a reference node, the other nodes can be numbered from V1 through Vn-1. With one node selected as the reference node, there will be n-1 independent equations. If we assume that the admittance between nodes i and j is given as Yij , we can write the nodal equations: Y11 V1 + Y12 V2 + Y21 V1 + Y22 V2 + Ym1 V1 + Ym2 V2 + + Y1m Vm = + Y2m Vm = + Ymm Vm =
I1 I2 Im (4.1)
where m=n-1 V1, V2 and Vm are voltages from nodes 1, 2 and so on ..., n with respect to the reference node.
[Y ][V ] = [ I ]
The solution of the above equation is
(4.2)
[V ] = [Y ] 1 [ I ]
where
(4.3)
[Y ] 1
is an inverse of
[Y ] .
V = inv (Y ) * I
where
(4.4)
V = IY
or
(4.5)
V =Y\I
(4.6)
The solutions obtained from Equations (4.4) to (4.6) will be the same, provided the system is not ill-conditioned. The following two examples illustrate the use of MATLAB for solving nodal voltages of electrical circuits. Example 4.1 For the circuit shown below, find the nodal voltages
20 Ohms V
V1 , V2 and V 3 .
10 Ohms
40 Ohms
5A
50 Ohms
2A
Solution Using KCL and assuming that the currents leaving a node are positive, we have For node 1,
V1 V2 V1 V3 + 5= 0 10 20
i.e.,
015 . V1 01 . V2 0.05V3 = 5
(4.7)
At node 2,
V2 V1 V2 V2 V3 + + =0 10 50 40
i.e.,
. V1 + 0145 . V2 0.025V3 = 0 01
(4.8)
At node 3,
V3 V1 V3 V2 + 2=0 20 40
i.e.,
(4.9)
5 0 2
(4.10)
The MATLAB program for solving the nodal voltages is MATLAB Script diary ex4_1.dat % program computes the nodal voltages
% given the admittance matrix Y and current vector I % Y is the admittance matrix and I is the current vector % initialize matrix y and vector I using YV=I form Y = [ 0.15 -0.1 -0.05; -0.1 0.145 -0.025; -0.05 -0.025 0.075]; I = [5; 0; 2]; % solve for the voltage fprintf('Nodal voltages V1, V2 and V3 are \n') v = inv(Y)*I diary The results obtained from MATLAB are Nodal voltages V1, V2 and V3, v= 404.2857 350.0000 412.8571 Example 4.2: Find the nodal voltages of the circuit shown below.
2 Ohms Ix V 5 Ohms V 10 I x V 15 Ohms V4
5A
20 Ohms
4 Ohms
10 Ohms
10 V
Solution Using KCL and the convention that currents leaving a node is positive, we have At node 1
V1 V1 V2 V1 V4 + + 5= 0 20 5 2
Simplifying, we get
(4.11)
V2 V3 = 10 I X
But
IX =
Thus
(V1 V4 ) 2 10(V1 V4 ) 2
V2 V3 =
Simplifying, we get - 5V1
+ V2 V3 + 5V4 = 0
(4.12)
V3 V2 V1 V2 V3 V4 + + + =0 10 5 4 15
Simplifying, we get
(4.13)
At node 4, we have
V4 = 10
In matrix form, equations (4.11) to (4.14) become
(4.14)
5 0 0 10
(4.15)
diary ex4_2.dat % this program computes the nodal voltages % given the admittance matrix Y and current vector I % Y is the admittance matrix % I is the current vector % initialize the matrix y and vector I using YV=I Y = [0.75 -0.2 0 -0.5; -5 1 -1 5; -0.2 0.45 0.166666667 -0.0666666667; 0 0 0 1]; % current vector is entered as a transpose of row vector I = [5 0 0 10]'; % solve for nodal voltage fprintf('Nodal voltages V1,V2,V3,V4 are \n') V = inv(Y)*I diary We obtain the following results. Nodal voltages V1,V2,V3,V4 are
4.2
LOOP ANALYSIS
Loop analysis is a method for obtaining loop currents. The technique uses Kirchoff voltage law (KVL) to write a set of independent simultaneous equations. The Kirchoff voltage law states that the algebraic sum of all the voltages around any closed path in a circuit equals zero. In loop analysis, we want to obtain current from a set of simultaneous equations. The latter equations are easily set up if the circuit can be drawn in planar fashion. This implies that a set of simultaneous equations can be obtained if the circuit can be redrawn without crossovers. For a planar circuit with n-meshes, the KVL can be used to write equations for each mesh that does not contain a dependent or independent current source. Using KVL and writing equations for each mesh, the resulting equations will have the general form: Z11I1 + Z12 I2 + Z13 I3 + Z21 I1 + Z22 I2 + Z23 I3 + Zn1 I1 + Zn2 I2 + Zn3 I3 + ... ... ... Z1n In = Z2n In = Znn In =
V1 V2 Vn (4.16)
where I1, I2, ... In are the unknown currents for meshes 1 through n. Z11, Z22, , Znn are the impedance for each mesh through which individual current flows. Zij, j # i denote mutual impedance.
[ Z ][ I ] = [V ]
where
(4.17)
Z11 Z 21 Z = Z31 .. Z n1 I1 I 2 I = I3 . In
and
Z1n Z2 n Z3 n .. Z nn
V1 V2 V = V3 .. V n
[ I ] = [ Z ] 1 [V ]
In MATLAB, we can compute [I] by using the command
(4.18)
I = inv ( Z ) * V
(4.19)
where
The matrix left and right divisions can also be used to obtain the loop currents. Thus, the current I can be obtained by the MATLAB commands
I =V Z
or
(4.20)
I = Z \V
(4.21)
As mentioned earlier, Equations (4.19) to (4.21) will give the same results, provided the circuit is not ill-conditioned. The following examples illustrate the use of MATLAB for loop analysis.
Example 4.3 Use the mesh analysis to find the current flowing through the resistor addition, find the power supplied by the 10-volt voltage source.
RB . In
15 Ohms
30 Ohms
Solution Using loop analysis and designating the loop currents as the following figure.
I 1 , I 2 , I 3 , we obtain
I1 10 V
10 Ohms
I2 5 Ohms I3
15 Ohms
30 Ohms
30 Ohms
Figure 4.3b
Note that
10( I 1 I 2 ) + 30( I 1 I 3 ) 10 = 0 40 I 1 10 I 2 30 I 3 = 10
(4.22)
Loop 2,
10( I 2 I 1 ) + 15I 2 + 5( I 2 I 3 ) = 0 10 I 1 + 30 I 2 5I 3 = 0
(4.23)
Loop 3,
30( I 3 I 1 ) + 5( I 3 I 2 ) + 30 I 3 = 0 30 I 1 5I 2 + 65I 3 = 0
(4.24)
40 10 30 I1 10 30 5 I = 2 30 5 65 I3
10 0 0
(4.25)
The MATLAB program for solving the loop currents and the power supplied by the 10-volt source is MATLAB Script
I 1 , I 2 , I 3 , the current I
diary ex4_3.dat % this program determines the current % flowing in a resistor RB and power supplied by source % it computes the loop currents given the impedance % matrix Z and voltage vector V % Z is the impedance matrix % V is the voltage matrix % initialize the matrix Z and vector V Z = [40 -10 -30; -10 30 -5; -30 -5 65]; V = [10 0 0]'; % solve for the loop currents I = inv(Z)*V; % current through RB is calculated IRB = I(3) - I(2); fprintf('the current through R is %8.3f Amps \n',IRB) % the power supplied by source is calculated PS = I(1)*10; fprintf('the power supplied by 10V source is %8.4f watts \n',PS) diary MATLAB answers are the current through R is 0.037 Amps the power supplied by 10V source is 4.7531 watts
Circuits with dependent voltage sources can be analyzed in a manner similar to that of example 4.3. Example 4.4 illustrates the use of KVL and MATLAB to solve loop currents.
Example 4.4 Find the power dissipated by the 8 Ohm resistor and the current supplied by the 10-volt source.
5V 6 ohms 15 Ohms 10 ohms
Is 6 Ohms 10 V 20 Ohms 4 Is
Figure 4.4a Circuit for Example 4.4 Solution Using loop analysis and denoting the loop currents as cuit can be redrawn as
6 Ohms I1 I2 10 V 20 Ohms 4 Is 15 Ohms 5V
10 Ohms
I3 6 Ohms 8 Ohms
Figure 4.4b
By inspection,
I S = I1
For loop 1,
(4.26)
10 + 6 I 1 + 20( I 1 I 2 ) = 0 26 I 1 20 I 2 = 10
For loop 2, (4.27)
15 I 2 5 + 6( I 2 I 3 ) + 4 I S + 20( I 2 I1 ) = 0
Using Equation (4.26), the above expression simplifies to
16 I1 + 41I 2 63 I = 5
For loop 3,
(4.28)
10 I 3 + 8 I 3 4 I S + 6( I 3 I 2 ) = 0
Using Equation (4.26), the above expression simplifies to
4 I 1 6 I 2 + 24 I 3 = 0
Equations (4.25) to (4.27) can be expressed in matrix form as
(4.29)
26 20 0 I1 16 41 6 I 2 = 4 6 24 I3
10 5 0
(4.30)
P = RI32 = 8 I32
The current supplied by the source is
I S = I1
A MATLAB program for obtaining the power dissipated by the 8 Ohm resistor and the current supplied by the source is shown below MATLAB Script diary ex4_4.dat % This program determines the power dissipated by % 8 ohm resistor and current supplied by the % 10V source % % the program computes the loop currents, given % the impedance matrix Z and voltage vector V % % Z is the impedance matrix % V is the voltage vector % initialize the matrix Z and vector V of equation % ZI=V Z = [26 -20 0; -16 40 -6; -4 -6 24]; V = [10 5 0]'; % solve for loop currents I = inv(Z)*V; % the power dissipation in 8 ohm resistor is P P = 8*I(3)^2; % print out the results fprintf('Power dissipated in 8 ohm resistor is %8.2f Watts\n',P) fprintf('Current in 10V source is %8.2f Amps\n',I(1)) diary MATLAB results are Power dissipated in 8 ohm resistor is 0.42 Watts Current in 10V source is 0.72 Amps For circuits that contain both current and voltage sources, irrespective of whether they are dependent sources, both KVL and KVL can be used to obtain equations that can be solved using MATLAB. Example 4.5 illustrates one such circuit.
Example 4.5 Find the nodal voltages in the circuit, i.e., V1 ,V2 , ..., V5
10 Ia V2 8 Ohms
10 Ohms Vb
V4
Ia V3 5 Ohms 4 Ohms
V5 5 Vb 2 Ohms 24 V 5A
Vb = V1 V4
Using Ohms Law
(4.31)
Ia =
V4 V3 5
(4.32)
V1 V1 V4 V V3 + 5Vb + 2 =0 2 10 8
Using Equation (4.31), Equation (4.33) simplifies to
(4.33)
(4.34)
V4 V5 V4 V3 V4 V1 + + = 10 4 5 10
This simplifies to
(4.35)
V3 V4 V3 V2 + 5= 0 5 8
which simplifies to
(4.36)
10 I a + Vb + 5I a + 8( I a + 5) = 0
Using Equations (4.31) and (4.32), Equation (4.37) becomes
(4.37)
10 I a + Vb + 5I a + 8 I a + 40 = 0
i.e.,
3I a + Vb = 40
V4 V3 + V1 V4 = 40 5
(4.38)
V1 0.6V3 0.4V4 = 40
By inspection
VS = 24
(4.39)
Using Equations (4.34), (4.35), (4.36), (4.38) and (4.39), we get the matrix equation
. . 4.9 0 V1 0125 4.4 0125 01 . 0 0.55 0.25 V2 0.2 0 . 0.325 0.2 0 V3 = 0125 0 0 V4 0.6 0.4 1 0 0 0 1 0 V5
0 0 5 40 24
(4.40)
The MATLAB program for obtaining the nodal voltages is shown below. MATLAB Script diary ex4_5.dat % Program determines the nodal voltages % given an admittance matrix Y and current vector I % Initialize matrix Y and the current vector I of % matrix equation Y V = I Y = [-4.4 0.125 -0.125 4.9 0; -0.1 0 -0.2 0.55 -0.25; 0 -0.125 0.325 -0.2 0; 1 0 -0.6 -0.4 0; 0 0 0 0 1]; I = [0 0 5 -40 24]'; % Solve for the nodal voltages fprintf('Nodal voltages V(1), V(2), .. V(5) are \n') V = inv(Y)*I; diary The results obtained from MATLAB are Nodal voltages V(1), V(2), ... V(5) are V= 117.4792 299.7708 193.9375 102.7917 24.0000
4.3
Vs
RL
VL
Figure 4.6 Circuit for Obtaining Maximum Power Dissipation The voltage across the Load R L is given as
VL =
Vs RL Rs + RL
PL =
The value of
VL2 Vs2 RL = RL ( Rs + RL ) 2
(4.41)
R L that dissipates the maximum power is obtained by differentiating PL with respect to RL , and equating the derivative to zero. That is, dPL ( Rs + RL ) 2 VS Vs RL ( 2)( Rs + RL ) = dRL ( Rs + RL )4 dPL =0 dRL
2
(4.42)
( Rs + R L ) 2 R L = 0
i.e.,
R L = RS
(4.43)
Thus, for a resistive network, the maximum power is supplied to a load provided the load resistance is equal to the source resistance. When R L = 0, the voltage across and power dissipated by
R L approaches infinity, the voltage across the load is maximum, but the
power dissipation is zero. MATLAB can be used to observe the voltage across and power dissipation of the load as functions of load resistance value. Example 4.6 shows the use of MATLAB to plot the voltage and display the power dissipation of a resistive circuit. Before presenting an example on the maximum power transfer theorem, let us discuss the MATLAB functions diff and find.
4.3.1
f ( x n ) =
f ( x n ) f ( x n1 ) x n x n1
(4.44)
f ( x n ) =
The derivative of as
f ( x n +1 ) f ( x n ) x n +1 x n
(4.45)
f = [ f (1)
f ( 2 ) ...
f ( n )]
diff ( f ) = [ f ( 2) f (1)
The output vector
f (3) f ( 2) ...
f ( n ) f ( n 1)]
(4.47)
The find function determines the indices of the nonzero elements of a vector or matrix. The statement B = find(
f)
(4.48)
will return the indices of the vector f that are nonzero. For example, to obtain the points where a change in sign occurs, the statement Pt_change = find(product < 0) will show the indices of the locations in product that are negative. The diff and find are used in the following example to find the value of resistance at which the maximum power transfer occurs. (4.49)
R L varies from 0 to 50K, plot the power dissipated by the load. Verify that the maximum power dissipation by the load occurs when R L
10,000 Ohms
10 V PL RL
VL
% maximum power transfer % vs is the supply voltage % rs is the supply resistance % rl is the load resistance % vl is the voltage across the load % pl is the power dissipated by the load vs = 10; rs = 10e3; rl = 0:1e3:50e3; k = length(rl); % components in vector rl % Power dissipation calculation for i=1:k pl(i) = ((vs/(rs+rl(i)))^2)*rl(i); end % Derivative of power is calculated using backward difference dp = diff(pl)./diff(rl); rld = rl(2:length(rl)); % length of rld is 1 less than that of rl % Determination of critical points of derivative of power prod = dp(1:length(dp) - 1).*dp(2:length(dp)); crit_pt = rld(find(prod < 0)); max_power = max(pl); % maximum power is calculated % print out results
fprintf('Maximum power occurs at %8.2f Ohms\n',crit_pt) fprintf('Maximum power dissipation is %8.4f Watts\n', max_power) % Plot power versus load plot(rl,pl,'+') title('Power delivered to load') xlabel('load resistance in Ohms') ylabel('power in watts') The results obtained from MATLAB are Maximum power occurs at 10000.00 Ohms Maximum power dissipation is 0.0025 Watts The plot of the power dissipation obtained from MATLAB is shown in Figure 4.8.
SELECTED BIBLIOGRAPHY 1. 2. 3. 4. 5. MathWorks, Inc., MATLAB, High-Performance Numeric Computation Software, 1995. Etter, D.M., Engineering Problem Solving with MATLAB, 2nd Edition, Prentice Hall, 1997. Gottling, J.G., Matrix Analysis of Circuits Using MATLAB, Prentice Hall, 1995. Johnson, D.E., Johnson, J.R. and Hilburn, J.L., Electric Circuit Analysis, 3rd Edition, Prentice Hall, 1997. Dorf, R.C. and Svoboda, J.A., Introduction to Electric Circuits, 3rd Edition, John Wiley & Sons, 1996.
EXERCISES 4.1 Use loop analysis to write equations for the circuit shown in Figure P4.1. Determine the current I using MATLAB.
6 Ohms
6 Ohms
15 Ohms
4.2
Use nodal analysis to solve for the nodal voltages for the circuit shown in Figure P4.2. Solve the equations using MATLAB.
V2 5 Ohms 6 Ohms
3A V1 2 Ohms
V3
3 Ohms
V4
4 Ohms
4A
6A
8 Ohms
V5
Figure P4.2 Circuit for Exercise 4.2 Find the power dissipated by the 4 resistor and the voltage V1 .
8A
4.3
I 2 Ohms 6 Ix
Vo 10 v Vy 4 Ohms 2 Ohms 3 Vy
4 Ohms
Figure P4.3
4.4
Using both loop and nodal analysis, find the power delivered by a 15V source. 2A
4 Ohms 4V
a
5 Ohms
8 Ohms Ix
10 I x
15 V
2 Ohms
Va
4.5
R L varies from 0 to 12 in increments of 2, calculate the power dissipated by RL . Plot the power dissipation with respect to the variation in RL . What is the maximum power dissipated by R L ? What is the value of R L needed for maximum power dissipation?
As
3 Ohms 2 Ohms 3 Ohms
12 Ohms 12 V 6 Ohms RL 36 V
4.6
Using loop analysis and MATLAB, find the loop currents. What is the power supplied by the source?
4 Ohms I1 4 Ohms
3 Ohms I2 2 Ohms 6V
2 Ohms I3 6V
3 Ohms
Figure P4.6
4 Ohms