The core Partial Differential Equation Toolbox™ algorithm uses the Finite Element Method (FEM) for problems defined on bounded domains in 2-D or 3-D space. In most cases, elementary functions cannot express the solutions of even simple PDEs on complicated geometries. The finite element method describes a complicated geometry as a collection of subdomains by generating a mesh on the geometry. For example, you can approximate the computational domain Ω with a union of triangles (2-D geometry) or tetrahedra (3-D geometry). The subdomains form a mesh, and each vertex is called a node. The next step is to approximate the original PDE problem on each subdomain by using simpler equations.
For example, consider the basic elliptic equation.
Suppose that this equation is a subject to the Dirichlet boundary condition on and Neumann boundary conditions on . Here, is the boundary of Ω.
The first step in FEM is to convert the original differential (strong) form of the PDE into an integral (weak) form by multiplying with test function and integrating over the domain Ω.
The test functions are chosen from a collection of functions (functional space) that vanish on the Dirichlet portion of the boundary, on . Above equation can be thought of as weighted averaging of the residue using all possible weighting functions . The collection of functions that are admissible solutions, u, of the weak form of PDE are chosen so that they satisfy the Dirichlet BC, u = r on .
Integrating by parts (Green's formula) the second-order term results in:
Use the Neumann boundary condition to substitute for second term on the left side of the equation. Also, note that on nullifies the third term. The resulting equation is:
Note that all manipulations up to this stage are performed on continuum Ω, the global domain of the problem. Therefore, the collection of admissible functions and trial functions span infinite-dimensional functional spaces. Next step is to discretize the weak form by subdividing Ω into smaller subdomains or elements , where . This step is equivalent to projection of the weak form of PDEs onto a finite-dimensional subspace. Using the notations and to represent the finite-dimensional equivalent of admissible and trial functions defined on , you can write the discretized weak form of the PDE as:
Next, let ϕi, with i = 1, 2, ... , Np, be the piecewise polynomial basis functions for the subspace containing the collections and , then any particular can be expressed as a linear combination of basis functions:
Here Ui are yet undetermined scalar coefficients. Substituting into to the discretized weak form of PDE and using each as test functions and performing integration over element yields a system of Np equations in terms of Np unknowns Ui.
Note that finite element method approximates a solution by minimizing the associated error function. The minimizing process automatically finds the linear combination of basis functions which is closest to the solution u.
FEM yields a system KU = F where the matrix K and the right side F contain integrals in terms of the test functions ϕi, ϕj, and the coefficients c, a, f, q, and g defining the problem. The solution vector U contains the expansion coefficients of uh, which are also the values of uh at each node xk (k = 1,2 for a 2-D problem or k = 1,2,3 for a 3-D problem) since uh(xk) = Ui.
FEM techniques are also used to solve more general problems, such as:
Time-dependent problems. The solution u(x,t) of the equation
can be approximated by
The result is a system of ordinary differential equations (ODEs)
Two time derivatives result in a second-order ODE
Eigenvalue problems. Solve
for the unknowns u and λ,
where λ is a complex number. Using the FEM
discretization, you solve the algebraic eigenvalue problem KU = λMU to
find uh as an approximation
to u. To solve eigenvalue problems, use
Nonlinear problems. If the coefficients c, a, f, q, or g are functions of u or ∇u, the PDE is called nonlinear and FEM yields a nonlinear system K(U)U = F(U).
To summarize, the FEM approach:
Represents the original domain of the problem as a collection of elements.
For each element, substitutes the original PDE problem by a set of simple equations that locally approximate the original equations. Applies boundary conditions for boundaries of each element. For stationary linear problems where the coefficients do not depend on the solution or its gradient, the result is a linear system of equations. For stationary problems where the coefficients depend on the solution or its gradient, the result is a system of nonlinear equations. For time-dependent problems, the result is a set of ODEs.
Assembles the resulting equations and boundary conditions into a global system of equations that models the entire problem.
Solves the resulting system of algebraic equations or ODEs using linear solvers or numerical integration, respectively. The toolbox internally calls appropriate MATLAB® solvers for this task.
 Cook, Robert D., David S. Malkus, and Michael E. Plesha. Concepts and Applications of Finite Element Analysis. 3rd edition. New York, NY: John Wiley & Sons, 1989.
 Gilbert Strang and George Fix. An Analysis of the Finite Element Method. 2nd edition. Wellesley, MA: Wellesley-Cambridge Press, 2008.