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 Raleigh damping. See Dynamics of Damped Cantilever Beam.

The full finite element matrices and vectors are the following:

`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
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`

.

Alternatively, 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`

.

The `'stiff-spring'`

technique generates matrices more quickly than the
`'nullspace'`

technique, but the
`'stiff-spring'`

technique
generally gives less accurate solutions.