170 Practical MATLAB® Applications for Engineers
MATLAB Solution
% script file: Thevenin
% The Thevenin’s equivalent circuit
% can be determined by experimental method
% based on the maximum power theorem
Vs =100;R1 = 20;R2 =60;
RL = 1:1:50; % range of RL
Rpar = (RL.*R2)./(RL+R2);
RT = Rpar + R1;
VL = (Rpar.*Vs)./RT;
PRL = (VL.^2)./RL;
[Pmax,index] = max(PRL);
Rth = RL(index);
Vth = sqrt(4*Rth*Pmax);
%...Display Vth and Rth
disp(‘*********************************’);
disp(‘*********R E S U L T S**********’);
disp(‘*********************************’);
disp(‘ ‘);
fprintf(‘The Thevenin voltage (in volts) is Vth=%f\n’,Vth);
fprintf(‘The Thevenin resistance (in ohms) is Rth=%f\n’,Rth);
disp(‘ ‘)
disp(‘*********************************’);The script fi le Thevenin is executed, and the results are shown as follows:>>Thevenin
*******************************************************
*************** R E S U L T S ************************
*******************************************************
The Thevenin voltage (in volts) is Vth =75.000000
The Thevenin resistance (in ohms) is Rth =15.000000
*******************************************************Note that the calculated results completely agree with the simulated experimental
results.Example 2.22Analyze the series RLC circuit shown in Figure 2.68, where the current source i(t) isgiven by i(t) = ( (^) π^2 ) (^) ∑
n=odd
15
( (^) n^1 ) sin(n π t). The equation for the current i(t) represents the Fourier
series approximation of a periodic square wave (see Chapter 4 for additional details).
Create the script fi le analysis that returns the following plots:
- i(t) versus t (verifi es the approximation of the periodic square wave)
- i^2 (t) versus t
3. ∫
i(t) dt versus t (verifi es the approximation of the periodic triangular wave)4.
di(t)
____dt versus t