% diferencias finitas
clear all
clc
close all

deltat=0.0001;
m=10000;
x1=zeros(m,1);
x2=zeros(m,1);
n=1;
x1(1)=10;
x2(1)=0;

while n<=m-1
    x1(n+1) = x2(n)*deltat + x1(n);
    x2(n+1) = -deltat*(0.1*x2(n) + 5*x1(n)) + x2(n);
    n = n+1;
end


figure(1, "visible", "off");
plot(x1);
grid;
print -deps "../media/diferencias_finitas.eps";



x3= -0.1*x2 - 5*x1;
figure(2, "visible", "off");
plot3(x1,x2,x3)
grid;
print -deps "../media/diferencias_finitas_3d.eps";