# Ordinary Differential Equations (ODE)

## Contents

The dynamics of complex system can be stated by a set of differential equations:

$$\frac{\text{d}\vec{x}}{\text{d}t} = \vec{F}(\vec{x}).$$

Unable to interpret TeX string. Undefined control sequence.

Several prototypical models are often used toys in nonlinear dynamics. One of them is the Lorenz system. The Lorenz system is a simplified weather modell describing turbulence with three states (two temperature distributions and velocity).

$$ \frac{\text{d}x}{\text{d}t} = -\sigma (x - y)$$ $$ \frac{\text{d}y}{\text{d}t} = r x - y - xz$$ $$ \frac{\text{d}z}{\text{d}t} = -b + xy.$$

Unable to interpret TeX string. Undefined control sequence.

For r = 28, \sigma = 10 and b = 8/3, this system has a chaotic behaviour.

Ordinary differential equations can be solved with Matlab. In order to solve the Lorenz ODE, we create a new file called `lorenz.m` with the following content

`function dx = lorenz(t,x)`

`dx = zeros(3,1);` `dx(1) = 10 * (x(2) - x(1));` `dx(2) = 28 * x(1) - x(2) - x(1) * x(3);` `dx(3) = x(1) * x(2) - 8/3 * x(3);`

Matlab has several ODE solvers, called, e.g., `ode45` or `ode113`, and whoch are appropriate for different problems and accuracies (have a look at the help text of the ODE solvers). The first
sover to try is `ode45`, which is working most of the times. Now we solve the Lorenz ODE by

```
[t x] = ode45('lorenz',[0 100],[10 10 10]);
```

The input arguments are the name of the Matlab file consisting the ODE, the time span of interest (between 0 and 100) and the initial values of the three components (x(1) = x(2) = x(3) = 10).

plot(t,x) xlabel('Time'), ylabel('x, y, z'), title('Lorenz System')

## Exercise

The Roessler system is given by $$\begin{eqnarray} \dot x &=& - y - z, \nonumber \\ \dot y &=& x + a \, y, \\ \dot z &=& b + z \, (x - c).\nonumber \end{eqnarray} $$

Solve the ODE by using Matlab's ODE solver for the time span [0 500] and store the data as an ASCII file called `roessler.dat`!