![]() |
OptFEM2DP1 Toolbox
V1.2
Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D
|
00001 function AElem=ElemStiffMat2DP1(q1,q2,q3,area) 00002 % function AElem=ElemStiffMat2DP1(q1,q2,q3,area) 00003 % Computation of the element stiffness matrix for 00004 % `P_1`-Lagrange finite elements 00005 % 00006 % Parameters: 00007 % q1: Coordinates of the first vertex in the triangle, `2\times 1` array 00008 % q2: Coordinates of the second vertex in the triangle, `2\times 1` array 00009 % q3: Coordinates of the third vertex in the triangle, `2\times 1` array 00010 % area: triangle area 00011 % 00012 % Return values: 00013 % AElem: Element stiffness matrix, `3\times 3` matrix 00014 % 00015 % Example: 00016 % @verbatim 00017 % q1=[0;0];q2=[0;1];q3=[1;0]; 00018 % area=1/2.; 00019 % AElem=ElemStiffMat2DP1(q1,q2,q3,area); 00020 % @endverbatim 00021 % Copyright: 00022 % See \ref license 00023 M=[q2-q3, q3-q1, q1-q2]; 00024 AElem=(1/(4*area))*M'*M;