1 function OK = test_ldg_derivative
2 %
function OK = test_ldg_derivative
4 %
function testing, whether the ldg basis
function derivatives
5 % gives approximately what is expected from finite differences.
7 % Bernard Haasdonk 28.8.2009
12 params.nelements = 10;
21 DPhis = ldg_evaluate_basis_derivative(x,params);
23 %
for each basis
function compute finite differences
24 Phis = ldg_evaluate_basis(x,params);
25 Phis_xph = ldg_evaluate_basis(x+[h,0],params);
26 Phis_yph = ldg_evaluate_basis(x+[0,h],params);
28 nbasefunc = length(DPhis);
30 Dphi_appr = [Phis_xph(i,:)-Phis(i,:); Phis_yph(i,:)-Phis(i,:)]
'/h;
31 maxerr = max(max(abs(Dphi_appr-DPhis{i})));
34 disp(['pdeg=
',num2str(pdeg),', i=
',num2str(i),...
35 ',|DPhi-DPhi_appr|=',num2str(maxerr)])
37 error(
'ldg function derivatives not correct!');