%%code for test heat_CN.m (Crank-Nicolson method)
set(0, 'defaultaxesfontsize',16,'defaultaxeslinewidth',1,...
    'defaultlinelinewidth',1,'defaultpatchlinewidth',0.7,...
    'defaulttextfontsize',16);

m1vals = [10 20 40 80];
ntest = length(m1vals);
hvals = zeros(ntest,1);  % to hold h values
E = zeros(ntest,1);      % to hold errors

for jtest=1:ntest
    m = m1vals(jtest);
    [h,k,error] = heat_CN(m);
    hvals(jtest) = h; %note k = 4*h;
    E(jtest)=error;
    
end

error_table(hvals, E);   % print tables of errors and ratios
error_loglog(hvals, E);  % produce log-log plot of errors and least squares fit
