% When R=Ra then i=ia:

Ra = 12;  ia = 0.5106;



% When R=Rb then i=ib

Rb = 6;   ib = 0.7164;



A = [1 -ia;   %

     1 -ib];  %

              % Eqn 5.9-6

b = [Ra*ia;   %

     Rb*ib];  %

	  

X = A\b;



Vt = X(1)  % Open Circuit Voltage



Rt = X(2)  % Thevenin Resistance

Figure 5.9-5 MATLAB file used to calculate the open-circuit voltage and the Thevenin resistance.