Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Assemble finite element matrices

`FEM = assembleFEMatrices(model)`

`FEM = assembleFEMatrices(model,bcmethod)`

The mass matrix

`M`

is nonzero when the model is time-dependent. By using this matrix, you can solve a model with Rayleigh damping. For an example, see Dynamics of Damped Cantilever Beam.For a thermal model, the

`m`

and`a`

coefficients are zeros. The thermal conductivity maps to the`c`

coefficient. The product of the mass density and the specific heat maps to the`d`

coefficient. The internal heat source maps to the`f`

coefficient.For a structural model, the

`a`

coefficient is zero. The Young's modulus and Poisson's ratio map to the`c`

coefficient. The mass density maps to the`m`

coefficient. The body loads map to the`f`

coefficient. When you specify the damping model by using the Rayleigh damping parameters`Alpha`

and`Beta`

, the discretized damping matrix`C`

is computed by using the mass matrix`M`

and the stiffness matrix`K`

as`C = Alpha*M+Beta*K`

.

The full finite element matrices and vectors are as follows:

`K`

is the stiffness matrix, the integral of the`c`

coefficient against the basis functions.`M`

is the mass matrix, the integral of the`m`

or`d`

coefficient against the basis functions.`A`

is the integral of the`a`

coefficient against the basis functions.`F`

is the integral of the`f`

coefficient against the basis functions.`Q`

is the integral of the`q`

boundary condition against the basis functions.`G`

is the integral of the`g`

boundary condition against the basis functions.The

`H`

and`R`

matrices come directly from the Dirichlet conditions and the mesh.

Given these matrices, the `'nullspace'`

technique generates the combined
finite element matrices [`Kc`

,`Fc`

,`B`

,`ud`

] as
follows. The combined stiffness matrix is for the reduced linear
system `Kc = K + M + Q`

. The corresponding combined
load vector is `Fc = F + G`

. The `B`

matrix spans the null space of the columns of `H`

(the Dirichlet condition matrix representing *hu* =
*r*). The `R`

vector
represents the Dirichlet conditions in `Hu = R`

. The
`ud`

vector represents the boundary
condition solutions for the Dirichlet conditions.

From the `'nullspace'`

matrices, you can compute
the solution `u`

as

`u = B*(Kc\Fc) + ud`

.

Internally, for time-independent problems, `solvepde`

uses
the `'nullspace'`

technique, and calculates solutions
using `u = B*(Kc\Fc) + ud`

.

The `'stiff-spring'`

technique returns a matrix `Ks`

and a
vector `Fs`

that together represent a different type
of combined finite element matrices. The approximate solution
`u`

is `u = Ks\Fs`

.

Compared to the `'nullspace'`

technique, the
`'stiff-spring'`

technique generates
matrices more quickly, but generally gives less accurate
solutions.

`PDEModel`

| `StructuralModel`

| `ThermalModel`

| `solve`

| `solvepde`