QUESTION 3
Background
[3 MARKS]
The van der Pol equation is a 2nd-order ODE that describes self-sustaining oscillations in which energy is
withdrawn from large oscillations and fed into the small oscillations. This equation typically models electronic
circuits containing vacuum tubes. The van der Pol equation is:
$\frac{d^2y}{dt^2} - \mu(1 - y^2)\frac{dy}{dt} + y = 0$
where y represents the position coordinate, t is time, and $\mu$ is a damping coefficient.
The 2nd-order ODE can be solved as a set of 1st-order ODEs, as shown below. Here, z is a 'dummy' variable.
$\frac{dy}{dt} = z$
$\frac{dz}{dt} = \mu(1 - y^2)z - y$
The two 1st-order ODEs above are coupled and must be solved simultaneously. i.e. the solutions are
dependent on each other and therefore cannot be solved individually. The first iteration will solve for $y_1$ and
$z_1$ using initial conditions $y_0$ and $z_0$. The second iteration will solve for $y_2$ and $z_2$ using $y_1$ and $z_1$, and so forth.
You are strongly encouraged to complete a few iterations by hand to fully understand the process.
Q3a
In the euler2.m file, complete the function file to perform Euler's method to solve two 1st-order ODE equations
simultaneously.
*You should still have three figure windows by the end of this task.
Q3b
In the Q3b.m file, consider initial conditions y(0) = 1 and z(0) = 1, and $\mu$ = 1.
Solve the van der Pol equation using the euler2() function written in Q2a with time steps of 0.25, 0.125 and
0.0625 from t = 0 to 30s.
In figure(4)¹, plot the following in 2-by-1 subplot arrangement using the 'colours' variable provided in the m-
file to represent time steps of 0.25, 0.125 and 0.0625, respectively.
\begin{itemize}
\item [Top panel] y against t solved using Euler's method for each time step
\item [Bottom panel] $\frac{dy}{dt}$ against t solved using Euler's method for each time step
\end{itemize}
It is suspected that the solutions obtained are not highly accurate. Use fprintf() to print a statement describing
how the accuracy of the solutions can be improved.