190 Practical MATLAB® Applications for Engineers
Note that the symbolic results shown in Figure 2.90 fully agree with the numerical
results shown in Figure 2.91.Example 2.27Steady-state conditions exist in the network shown in Figure 2.92 at t = 0 −, when the
V 1 = 10 V source is connected to the RC circuit. At t = 0 +, the switch moves downward,
and the V 2 = 20 V source is connected to the RC circuit (while the source V 1 = 10 V is
disconnected), for t ≥ 0.- Write and solve the loop differential equation by hand, for the current i(t) (through
RC) and the voltages vR(t) and vC(t), for t ≥ 0. - Create the script fi le RC_ IC that returns the solutions for part 1 using the MATLAB
symbolic solver dsolve. - Repeat part 1 by using the MATLAB numerical solver ode45.
- Also, obtain the plots of
a. i(t) versus t
b. vR(t) versus t
c. vc(t) versus t
over the range 0 ≤ t ≤ 2 s, for parts 2 and 3.
FIGURE 2.91
Plots of numerical transient solutions of Example 2.26.1.61.41.210.80.60.40.20 21.864810plots of [i(t), vr(t), and vL(t)] versus ti(t) in ampsvr(t) in voltsvL(t) in volts1.61.41.210.80.60.40.20 21.81015101.61.41.210.8 21.8
time in sec0.60.40.200510