| OptFEM2D Toolbox for Matlab V1.2b1 Matlab/Octave Optimized P1-Lagrange Finite Element Method in 2D

- Main Page
- Related Pages
- Files

- File List
- File Members

All Files Functions Pages
ElemStiffMatP1.m
Go to the documentation of this file.
1 function AElem=ElemStiffMatP1(q1,q2,q3,area)
2 % function AElem=ElemStiffMatP1(q1,q2,q3,area)
3 % Computation of the element stiffness matrix for
4 % `P_1`-Lagrange finite elements
5 %
6 % Parameters:
7 % q1: Coordinates of the first vertex in the triangle, `2\times 1` array (double)
8 % q2: Coordinates of the second vertex in the triangle, `2\times 1` array (double)
9 % q3: Coordinates of the third vertex in the triangle, `2\times 1` array (double)
10 % area: triangle area (double)
11 %
12 % Return values:
13 % AElem: Element stiffness matrix, `3\times 3` matrix (double)
14 %
15 % Example:
16 % @verbatim
17 % q1=[0;0];q2=[0;1];q3=[1;0];
18 % area=1/2.;
19 % AElem=ElemStiffMatP1(q1,q2,q3,area);
20 % @endverbatim
21 %
22 % OptFEM2DP1 [V1.2b1] - Copyright (C) 2013 CJS (LAGA)
23 %
24 % This file is part of OptFEM2DP1.
25 % OptFEM2DP1 is free software: you can redistribute it and/or modify
26 % it under the terms of the GNU General Public License as published by
27 % the Free Software Foundation, either version 3 of the License, or
28 % (at your option) any later version.
29 %
30 % OptFEM2DP1 is distributed in the hope that it will be useful,
31 % but WITHOUT ANY WARRANTY; without even the implied warranty of
32 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
33 % GNU General Public License for more details.
34 %
35 % You should have received a copy of the GNU General Public License
36 % along with this program. If not, see <http://www.gnu.org/licenses/>.
37 M=[q2-q3, q3-q1, q1-q2];
38 AElem=(1/(4*area))*M'*M;