t = 0;
h = 1;
x = 4.97;
y = -0.0069;
z = 0;
a = 0.583;
b = -52;
c = -0.308;
d = -0.0505;
e = 0.0009;
f = -1;
E1 = (a*x)-(b*(x.*y))-(c*z);
E2 = -d*y + e*(x.*y);
E3 = f*z;
for n =1:(length(x)-1)
m1 = (E1);
k1 = (E2);
j1 = (E3);
m2 = h*(t(n)+h/2, x(n)+m1/2, y(n)+k1/2, z(n)+j1/2);
k2 = h*(t(n)+h/2, x(n)+m1/2, y(n)+k1/2, z(n)+j1/2);
j2 = h*(t(n)+h/2, x(n)+m1/2, y(n)+k1/2, z(n)+j1/2);
m3 = h*(t(n)+h/2, x(n)+m2/2, y(n)+k2/2, z(n)+j2/2);
k3 = h*(t(n)+h/2, x(n)+m2/2, y(n)+k2/2, z(n)+j2/2);
j3 = h*(t(n)+h/2, x(n)+m2/2, y(n)+k2/2, z(n)+j2/2);
m4 = h*(t(n)+h, x(n)+m3, y(n)+k3, z(n)+j3);
k4 = h*(t(n)+h, x(n)+m3, y(n)+k3, z(n)+j3);
j4 = h*(t(n)+h, x(n)+m3, y(n)+k3, z(n)+j3);
t(n+1) = t(n) + h;
x(n+1) = x(n) + (1/6) * (m1 + (2*m2) + (2*m3) + m4);
y(n+1) = y(n) + (1/6) * (k1 + (2*k2) + (2*k3) + k4);
z(n+1) = z(n) + (1/6) * (j1 + (2*j2) + (2*j3) + j4);
end
plot(t(n+1),x(n+1))
plot(t(n+1),y(n+1))
plot(t(n+1),z(n+1))