clear all
clc
close all

n = 1;
N = 100000;

dt = 0.0001;

x = y = z = zeros(N,1);

rho   = 28;
sigma = 10;
beta  = 8/3;

# condiciones iniciales
x(1) = 2;
y(1) = 4;
z(1) = 3;

while n<=N
  x(n+1) = sigma*(y(n)-x(n))*dt        + x(n);
  y(n+1) = x(n)*(rho-z(n))*dt-y(n)*dt  + y(n);
  z(n+1) = x(n)*y(n)*dt - beta*z(n)*dt + z(n);
  n += 1;
end

plot3(x,y,z)
grid