I found a forum where someone called "Mr Fantastic" in a title, so I was hoping I might be able to do the same with Captainblack.

I was hoping you could help me Mr. Black, sorry, CAPTAIN Black, because you seem to have an extensive knowledge of MATLAB.

With respect to my post above, I have come up with new mfiles I think are close, but i am unsure of where I have gone wrong. Im thinking its trapezoid.m. I know its incorrect because the plot i obtain looks nothing like a lorenz equations plot should look like

function z = ydot(t,y)

% Lorenz Equations

s=10; r=28; b=8/3;

z(1) = s*y(2) - s*y(1);

z(2) = r*y(1) - y(1)*y(3) - y(2);

z(3) = y(1)*y(2)-b*y(3);

-------------------------------------------------------------------

An mfile for the trapezoid method.......(I am not 100% on this one)

-------------------------------------------------------------------

function y = trapezoid(t,x,h)

z1 = ydot(t,x);

g=x+h*z1;

z2=ydot(t+h,g);

g=x+h*z2;

z3=ydot(t+h,g);

y=x+h*(z1+z2+z3)/2;

-----------------------------------------------------------------------

function [t,y] = lorentz(int,ic,h);

n=round((int(2)-int(1))/h);

y(1, : ) =ic;

t(1) = int(1);

for k=1:n

t(k+1) = t(k) + h;

y(k+1, : ) = trapezoid(t(k),y(k,: ) ,h);

end

plot3(t,y(:,1),t,y(:,2),t,y(:,3));

-----------------------------------------------------------------

now as far as an actual matlab session,

just type:

lorentz([0 20], [5 5 5], 0.001)

Can anyone see where Ive gone wrong here?