1 function V = fem_basis_weight_matrix(pdeg)
2 %
function V = fem_basis_weight_matrix(pdeg)
4 %
function returning the weight matrix
for a lagrange basis on the
5 % reference triangle used by fem_evaluate_basis
7 % with p(x) the monomial basis, i.e. power_vector2
9 % for pdeg = 1 the matrix is explicitly given
10 % for higher pdegs it is computed, hence expensive. Simply insert
11 % the obtained matrices hardcode into this file, if your pdeg is
14 % Bernard Haasdonk 12.1.2011
31 2 -11 -11 18 36 18 -9 -27 -27 -9
32 0 18 0 -45 -45 0 27 54 27 0
33 0 -9 0 36 9 0 -27 -27 0 0
35 0 0 18 0 -45 -45 0 27 54 27
36 0 0 0 0 54 0 0 -54 -54 0
38 0 0 -9 0 9 36 0 0 -27 -27
44 3 -25 -25 70 140 70 -80 -240 -240 -80 32 128 192 128 32
45 0 48 0 -208 -208 0 288 576 288 0 -128 -384 -384 -128 0
46 0 -36 0 228 84 0 -384 -432 -48 0 192 384 192 0 0
47 0 16 0 -112 -16 0 224 96 0 0 -128 -128 0 0 0
48 0 -3 0 22 0 0 -48 0 0 0 32 0 0 0 0
49 0 0 48 0 -208 -208 0 288 576 288 0 -128 -384 -384 -128
50 0 0 0 0 288 0 0 -672 -672 0 0 384 768 384 0
51 0 0 0 0 -96 0 0 480 96 0 0 -384 -384 0 0
52 0 0 0 0 16 0 0 -96 0 0 0 128 0 0 0
53 0 0 -36 0 84 228 0 -48 -432 -384 0 0 192 384 192
54 0 0 0 0 -96 0 0 96 480 0 0 0 -384 -384 0
55 0 0 0 0 12 0 0 -48 -48 0 0 0 192 0 0
56 0 0 16 0 -16 -112 0 0 96 224 0 0 0 -128 -128
57 0 0 0 0 16 0 0 0 -96 0 0 0 0 128 0
58 0 0 -3 0 0 22 0 0 0 -48 0 0 0 0 32
61 % these computations should not be done everytime!
62 % for higher pdeg, perhaps also use higher accuracy!!!
63 disp(['please hardcode the following matrix into' ...
64 ' fem_basis_weight_matrix:']);
65 % V = inv(P) where P = (p(l1),...p(lm)) powervector of lagrange-nodes
66 lagrange_nodes = lagrange_nodes_lcoord(pdeg);
67 P = zeros(size(lagrange_nodes,1));
68 for i = 1: size(lagrange_nodes,1)
69 P(:,i) = power_vector2(lagrange_nodes(i,:),pdeg);