%% INPUT -----------------------------------------------------------------+
a = 0; % left time interval limit
b = 10; % right time interval limit
x0 = 1; % initial condition
N = 10; % number of points
tol = 1e-9; % tolerance
f = @(t,x) x; % function f
%% SOLVER ----------------------------------------------------------------+
[t,x,error] = RKF45(a,b,x0,N,tol,f); % Runge-Kutta-Fehlberg 4th order adaptative scheme
%% OUTPUT ----------------------------------------------------------------+
figure;
y = exp(t).'; % exact solution
plot(t,x,'-*',t,y,'k-') 
xlabel('time');
legend('RKF45 solution','exact solution');

figure;
real_error = abs(y-x);
semilogy(t,error,t,real_error)
legend('RKF45 local error','real error');