clc;
clear all;
close all;
% *************************************************************************
f=@(x,y) y;
x0=0;y0=1;xn=3;h=0.1;
x=x0:h:xn;
% *************************************************************************
[sol1]=eular(f,x0,y0,xn,h);
[sol2]=heun(f,x0,y0,xn,h);
[sol3]=fourth_order_RK_method(f,x0,y0,xn,h);
% Comparison of the methods by comparing their solutions with analytical
% solution
% *************************************************************************
figure(1)
plot(x,sol1,'-r',x,sol2,'^-g',x,sol3,'*-k',x,exp(x),'o-')
title('Comparison of the Methods')
xlabel('x-values')
ylabel('y-values')
legend('euler','heun','RK4','exact sol')