% convtest.m


%atols = [1e-6 1e-7 1e-8 1e-9 1e-10 1e-11 1e-12];
%rtols = [1e-3 1e-4 1e-5 1e-6 1e-7  1e-8  1e-9];

atols = logspace(-4, -9, 10);
rtols = logspace(-1, -6, 10);


Rs = zeros(size(atols));
Ts = zeros(size(atols));
Rerrs = zeros(size(atols));
Terrs = zeros(size(atols));

for n=1:length(atols)
  atol = atols(n);
  rtol = rtols(n);
  wave2
  Rs(n) = R;
  Ts(n) = T;
  Rerrs(n) = Rerr;
  Terrs(n) = Terr;
end

figure(5); clf;
semilogx(atols, Rerrs, 'b*-', atols, Terrs, 'ro-');

xlabel('atols');
ylabel('error');
legend('R error', 'T error');
