Search for question
Question

Problem 3:Consider the following 2nd order ODE: \frac{d^{2} y}{d t^{2}}-\left(1-y^{2}\right) \frac{d y}{d t}+y=0 with the initial conditions given by y(t=0)=1, \quad \frac{d y}{d t}(t=0)=1 (a) Convert this into a system

of two 1 st order ODES. (b) Solve this system of ODES for t = 0 to 10 in Matlab by writing a script that uses the M-file function rk4sys.m, which is based on the classical fourth order Runge-Kutta method,posted in Canvas under Lecture 25 with two different time steps h= 0.25 and 0.125. Plotthe results of the two dependent variables as a function of time. (c) Solve this system of ODES for t = 0 to 10 in Matlab by writing a script that invokes the Matlab built-in function ode45, which uses adaptive time steps, i.e., determines the time step needed automatically. Plot the results of the two dependent variables as a function of time.Note: The syntax for this built-in function is [t, y] = ode45(odefun, tspan, y0), where odefun is the name of the function that contains the right side of the system of differential equations and tspan contains the initial and final values of the independent variables.

Fig: 1

Fig: 2

Fig: 3

Fig: 4

Fig: 5

Fig: 6

Fig: 7