%Euler integration of Romeo and Juliet Model

%J = emotions of Juliet
%R = emotions of Romeo
%t = time
%dt = time step
%tot_time = total time

tot_time = 50;
dt = 0.01;
t = (0:dt:tot_time); %creates a vector of length tot_time/dt +1 from 0 to Tot_time of step size dt
a = 0.2;
b = 0.4;
J = zeros(size(t)); %initializing J to be all zeros
R = zeros(size(t)); %initializing R to be all zeros

R(1) = 3.14; %Romeo's initial feelings
J(1) = -0.5; %Juliet's initial feelings

for n = 1:(tot_time/dt+1)-1
R(n+1) = R(n) + dt*a*J(n);
J(n+1) = J(n) - dt*b*R(n);
end

figure(1)
clf %clears figure 1
plot(t,R,'b') %plot romeo's feelings versus time in blue
hold on %keeps from erasing R when plot J
plot(t,J,'r') %plot juliet's feelings versus time in red
legend('Romeo', 'Juliet')
xlabel('Time')
ylabel('Emotions')
set(gca,'Box','Off');
set(figure(1),'color','white');

