n_arr = [10 20 50 100];

prev_h = 0.2;
x = 0:0.2:1;
ts = exp(-1)*(exp(x) - 1);
[xx, ns1] = sl_fem2('a', 'f214', prev_h*ones(1, 5), [0 1]);
prev_e1 = max(abs(ts - ns1'));
[5 prev_h prev_e1]

for k=1:length(n_arr)
  h = 1 / n_arr(k);
  x = 0:h:1;
  ts = exp(-1)*(exp(x) - 1);
  [xx, ns1] = sl_fem2('a', 'f214', h*ones(1, n_arr(k)), [0 1]);
  e1 = max(abs(ts - ns1'));
  r1 = log(e1 / prev_e1) / log(h / prev_h);
  [n_arr(k) h e1 r1]
  prev_e1 = e1; prev_h = h;
end
