clar all
clc


J = 1;
ipsi = 0.4;
K = 1;
B = ipsi*2*sqrt(K);



deltat = 0.00001;
t = 0:deltat:10;
N = length(t);
x1 = zeros(N,1);
x2 = x1;

n = 1 ;
r = 1;

while n < N
  x1(n+1) = deltat*x2(n) + x1(n);
  x2(n+1) = (1-(deltat*B)/J)*x2(n)+(deltat*K/J)*(1-x1(n));
  n = n+1;
end

plot(t,x1)