% Let Romeo's love for Juliet at time t be R(t) % Let Juliet's love for Romeo at time t be J(t) % Problem 1 % R' = aJ and J'=-bR a=1; b=1; c=11; d=1; tspan =[0 20]; %domain under consideration ic=[2 0]; % initial condition dxdt = @(t,x) [a*x(1) + b*x(2); c*x(1)+d*x(2)]; % R is x(1); J is x(2) [t, x] = ode45(dxdt, tspan, ic); %plot(t,x(:,1),'b') plot(t,x(:,1),'b',t,x(:,2),'g') xlabel('t', 'FontSize', 20) ylabel( 'R(t), J(t)', 'FontSize', 20) legend ({'R(t)', 'J(t)'}, 'FontSize', 18) axis([0 20 -2.5 2.5 ]) grid on