% h
h1=sqrt(2/size(t1,2));
h2=sqrt(2/size(t2,2));
h3=sqrt(2/size(t3,2));
h4=sqrt(2/size(t4,2));

% Data
h   = [h1,h2,h3,h4];
err = [errMax1,errMax2,errMax3,errMax4];

% Post-process
plot(log10(h),log10(err),'bo-','DisplayName','Convergence Plot')
grid on;
xlabel('log_{10} (h)','FontSize',16,'FontWeight','bold');
ylabel('log_{10} (max error)','FontSize',16,'FontWeight','bold');
set(gca,'FontWeight','bold');
set(gca,'FontSize',16);
title('Convergence Plot','FontSize',18,'FontWeight','bold');
xlim([-2.1 -1])
ylim([-3.8 -2])

% Compute slopes
n = length(h);
for i=1:n-1
    slopes = log10(err(i+1)/err(i)) / log10(h(i+1)/h(i))
end
