G'day all,

I have the following Lorenz equations

$\displaystyle x' = 10(y - x) $

$\displaystyle y' = x(28 - z) -y $

$\displaystyle z' = xy - \frac{8}{3}z $

I need to calculate the trajectory of $\displaystyle Y(t) = (x(t), y(t), z(t)) $ in MATLAB using Heun's method (which I think is also called the trapezoidal method) with step size h=0.001, and initial conditions $\displaystyle Y(0) = (5,5,5) $ for t < 30.

Here is my matlab code for a single IVP (using Heun's method):

function y = heuns(f,t,x,h)

g = f(t,x);

z = x + h * g;

y = x + 0.5 * h * ( g + f(t+h,z) );

where f is a MATLAB inline function, h is the step size, t is the initial time, and x is the initial condition. However, I dont know how to use this method for the system of Lorenz equations above. Any suggestions?

(Worried)