088be4cAn interactive tutorial on the Dirichlet problem, accuracy against costJeremy Magland 1function q = lp_orders(e, n)
2% LP_ORDERS Observed convergence order between successive refinements.
3%
4% q(k) = log(e(k-1)/e(k)) / log(n(k)/n(k-1)), and NaN wherever the ratio is not
e5fc8c6An introduction and static figures, and the MATLAB written plainly againJeremy Magland 5% a positive finite number — an error of exactly zero, or a resolution a method
6% skipped, would otherwise put an Inf or a complex value in the table.
088be4cAn interactive tutorial on the Dirichlet problem, accuracy against costJeremy Magland 7q = NaN(size(e));
8for k = 2:numel(e)
9 r = e(k-1) / e(k);
10 if isfinite(r) && r > 0
11 q(k) = log(r) / log(n(k) / n(k-1));
12 end
13end
14end