Page 307 - Applied Numerical Methods Using MATLAB
P. 307

296    ORDINARY DIFFERENTIAL EQUATIONS
                                   −1
                     X(s) = [sI − A] {x(0) + BU(s)}
                                                              1
                                1         s + 3  1
                                                           1
                                                    1
                         =                             +
                            s(s + 3) + 2  −2   s    0      0  s
                                 1        s + 3 + 1/s
                         =
                            (s + 1)(s + 2)  −2 + 1
                              2
                             (s + 3s + 1)/s(s + 1)(s + 2)
                         =
                                 −1/(s + 1)(s + 2)
                            1/2    1      1/2           1    −t  1  −2t
                    X 1 (s) =  +       −      ,  x 1 (t) =  + e  − e   (P6.1.2a)
                             s    s + 1  s + 2          2        2
                             −1      1                    −t    −2t
                    X 2 (s) =    +      ,        x 2 (t) =−e  + e      (P6.1.2b)
                            s + 1  s + 2
                (b) Find the numerical solution of the above state equation by using the
                   routine “ode_RK4()” (with the number of segments N = 50) and the
                   MATLAB built-in routine “ode45()”. Compare their execution time
                   (by using tic and toc) and closeness to the analytical solution.
            6.2 A Second-Order Linear Time-Invariant Differential Equation

                Consider the following second-order differential equation



                    x (t) + 3x (t) + 2x(t) = 1  with x(0) = 1,x (0) = 0  (P6.2.1)
                (a) Check the procedure and the result of obtaining the analytical solution
                   by using the Laplace transform technique.
                                                                        1
                          2
                         s X(s) − x (0) − sx(0) + 3(sX(s) − x(0)) + 2X(s) =
                                                                        s
                                   2
                                  s + 3s + 1             1        1
                         X(s) =              ,    x(t) =  + e −t  − e −2t  (P6.2.2)
                                s(s + 1)(s + 2)          2        2
                (b) Define the differential equation (P6.2.1) in an M-file so that it can be
                   passed to the MATLAB routines like “ode_RK4()”or“ode45()”as
                   their input argument (see Section 6.5.1).

            6.3 Ordinary Differential Equation and State Equation
                (a) Van der Pol Equation
                   Consider a nonlinear differential equation
                       d 2            2    d
                         y(t) − µ(1 − y (t))  y(t) + y(t) = 0 with µ = 2  (P6.3.1)
                      dt 2                dt

                   Compose a program to solve this equation with the initial condition

                   [y(0)y (0)] = [0.50]and [−1 2] for the time interval [0, 20] and plot

                   y (t) versus y(t) as well as y(t) and y (t) along the t-axis.
   302   303   304   305   306   307   308   309   310   311   312