Solving Differential Equations with MATLAB MATLAB has a built-in function for solving ordinary differential equations called dsolve.
Question:
Solving Differential Equations with MATLAB MATLAB has a built-in function for solving ordinary differential equations called dsolve. We can use this function to quickly explore the solution to a second-order differential equation when the forcing function is a sinusoidal or exponential signal. Suppose we have a series RLC circuit in the zero state connected to a voltage source vTðtÞ. The parameter values are R ¼ 4 kV, L ¼ 1 H, and C ¼ 1 mF. The differential equation for the voltage across the capacitor is given by Eq. (7–33). If vT(t) ¼ 10 u(t) V, we can use the following MATLAB code to solve for the capacitor voltage and plot the results
% Define the symbolic time variable syms t real
% Define the parameter values R = 4000;
L = 1;
C = le-6;
% Solve the differential equation for the series RLC circuit with zero
% initial conditions vCt = dsolve (’L*C*D2v + R*C*Dv + v = 10’,
’v (0) =0 ’,’ Dv (0) =0 ’ , ’ t’);
% Create a time vector for plotting and substitute in numerical values tt = 0:0.0001:0.04;
vCt = subs(vCt);
vCtt = subs(vCt,t,tt);
% Plot the results figure plot(tt,vCtt,’b’,’LineWidth’,2)
grid on xlabel(’Time, (s) ’ )
ylabel(’v_C(t), (V)’)
title(’Problem 7-89’)
Run the givenMATLAB code and examine the results. Modify the code to solve the same problem when the input voltage is vTðtÞ ¼ 10 cos(200 p t) V. Solve the problem a third time for vTðtÞ ¼ 10 e2000t V. Compare and comment on the responses for the three different types of inputs signals.
Step by Step Answer:
The Analysis And Design Of Linear Circuits
ISBN: 9781118214299
7th Edition
Authors: Roland E Thomas, Albert J Rosa, Gregory J Toussaint