3 % Computation of the element stiffness matrix
for
4 % `P_1`-Lagrange finite elements
7 % q1: Coordinates of the first vertex in the triangle, `2\times 1` array
8 % q2: Coordinates of the second vertex in the triangle, `2\times 1` array
9 % q3: Coordinates of the third vertex in the triangle, `2\times 1` array
13 % AElem: Element stiffness matrix, `3\times 3` matrix
17 % q1=[0;0];q2=[0;1];q3=[1;0];
23 M=[q2-q3, q3-q1, q1-q2];
24 AElem=(1/(4*area))*M
'*M;