r = 1;

t0 = 0;
y0 = [r; 0];
T = 10;

A = @(t) [0 -1; 1 0];
f = @(t,y) A(t) * y;

h = 0.1;
t = t0:h:T;
y_true = r*[cos(t); sin(t)];

y_euler = euler_explicit(h,f,t0,y0,T);
y_im = euler_implicit(h,f,t0,y0,T,A);
y_trapez = trapez(h,f,t0,y0,T,A);

figure(1), clf, hold on
plot(y_true(1,:),y_true(2,:), '-k','DisplayName','True Solution')
plot(y_euler(1,:),y_euler(2,:), '-b','DisplayName','Explicit Euler')
plot(y_im(1,:), y_im(2,:),'-r', 'DisplayName', 'Implicit Euler')
plot(y_trapez(1,:), y_trapez(2,:),'--g', 'LineWidth',2, 'DisplayName', 'Trapezoidal Rule')
legend('Location', 'SouthEast')
