5.9 Using MATLAB to Determine the Thévenin Equivalent Circuit

 

First, the code from Figure 5.9-2

The way the code is written in the book, the code from Figure 5.9-2 would be in a file. To run from the command line without saving a file, you must set R before typing in the coefficient matrix.

                                        
         
>> R = 6;
         
         

Enter coefficient matrix and voltage vector from:

(5.9-3)

Note the use of ellipsis (...) to continue a line and the use of the transpose operator (') on V to write a column vector as the transpose of a row vector.

         
>> Z = [28 -10 -8;...
         
     -10 28 -8;...
         
     -8, -8, 16+R]
         
         Z =
         
         
         
    28   -10    -8
         
   -10    28    -8
         
    -8    -8    22
         
>> V = [12 12 0]'
         
         V =
         
         
         
    12
         
    12
         
     0
         
         

Use left division to solve for the i values in (5.9-3). Left division in this way is like solving inv(Z)*V.

         
>> Im = Z\V
         
Im =
         
         
         
    0.9851
         
    0.9851
         
    0.7164
         
         

To get a particular component (for example, i3), extract that element from Im by giving the index number. In this case, the third element is extraced as shown at right.

         
>> I3 = Im(3)
         
         I3 =
         
         
         
    0.7164
         
         

To get the second point, change R and run the commands again.

         
>> R = 12;
         
         >> Z = [28 -10 -8;...
         
     -10 28 -8;...
         
     -8, -8, 16+R];
         
         >> V = [12 12 0]';
         
         >> Im = Z\V;
         
         >> I = Im(3)
         
         I =
         
         
         
    0.5106
         
         

Next, code from Figure 5.9-5 can solve for the Thévenin resistance and open-circuit voltage

Set load resistances and the currents through these resistances.

         
>> Ra = 12; ia = 0.5106;
         
         >> Rb = 6;  ib = 0.7164;
         
         

Set the coefficient matrix and terminal voltage vector (on the right side of the equation) from:

(5.10-6)
         
>> A = [1 -ia; 1 -ib]
         
         A =
         
         
         
    1.0000   -0.5106
         
    1.0000   -0.7164
         
>> b = [Ra*ia; Rb*ib]
         
         b =
         
         
         
    6.1272
         
    4.2984
         
         

Finally, solve for the open circuit voltage and the Thévenin resistance using left-division and extracting the components.

         
>> X = A\b
         
         X =
         
         
         
   10.6645
         
    8.8863
         
>> Vt = X(1)
         
         Vt =
         
         
         
   10.6645
         
>> Rt = X(2)
         
         Rt =
         
         
         
    8.8863