Page 89 - MATLAB an introduction with applications
P. 89

74 ———  MATLAB: An Introduction with Applications

                   Example E1.25: Determine the solution of the following differential equations that satisfies the given initial
                   conditions.
                              dy
                                      2
                          (a)    =− 7x ;    y (1) =  0.7
                              dx
                              dy
                                        2
                                    x
                          (b)    =  5cos y ; y(0) = π/4
                              dx
                              dy
                                    y
                                        3x
                          (c)    =− +  e ; y(0) = 2
                              dx
                              dy
                          (d)    +  5 y =  35 ; y(0) = 4
                               dt
                   Solution:
                   (a)  >> dsolve (‘Dy = –7*x^2’,‘y (1) =0.7’)
                        ans =
                            –7*x^2*t + 7*x^2 + 7/10
                   (b)  >> dsolve (‘Dy=5*x*cos (y) ^2’,‘y (0) =pi/4’)
                        ans =
                            atan (5*t*x + 1)
                   (c)  >> dsolve (‘Dy = –y + exp (3*x)’, ‘y (0) =2’)
                        ans =
                             exp (3*x) + exp (– t)*(–exp (3*x) +2)
                   (d)  >> dsolve (‘Dy + 5*y =35’, ‘y (0) =4’)
                        ans =
                            7 – 3*exp (–5*t)

                   Example E1.26: Given the differential equation
                                 2
                               dx     dx
                                          5 = u t ; t ≥ 0
                                      +  7  + x  8 ( )
                               dt 2   dt
                   Using MATLAB program, find
                       (a) x(t) when all the initial conditions are zero.
                       (b) x(t) when x (0) = 1 and    x = 2.
                   Solution:
                   (a) x (t) when all the initial conditions are zero
                       >> x = dsolve (‘D2x = –7*Dx – 5*x +8’, ‘x (0) = 0’)
                       x =
                          8/5+ (–8/5–C2)*exp (1/2*(–7+29^ (1/2))*t) + C2*exp (–1/2*(7+29^
                                  (1/2))*t)

                   (b) x (t) when x (0) = 1 and   x = 2
                       >> x = dsolve (‘D2x = –7*Dx – 5*x +8’, ‘x (0) = 1’, ‘Dx (0) = 2’)










                   F:\Final Book\Sanjay\IIIrd Printout\Dt. 10-03-09
   84   85   86   87   88   89   90   91   92   93   94