## Documentation Center |

Assemble stiffness matrix and right side of PDE problem

u=assempde(b,p,e,t,c,a,f) u=assempde(b,p,e,t,c,a,f,u0) u=assempde(b,p,e,t,c,a,f,u0,time) u=assempde(b,p,e,t,c,a,f,time) [K,F]=assempde(b,p,e,t,c,a,f) [K,F]=assempde(b,p,e,t,c,a,f,u0) [K,F]=assempde(b,p,e,t,c,a,f,u0,time) [K,F]=assempde(b,p,e,t,c,a,f,u0,time,sdl) [K,F]=assempde(b,p,e,t,c,a,f,time) [K,F]=assempde(b,p,e,t,c,a,f,time,sdl) [K,F,B,ud]=assempde(b,p,e,t,c,a,f) [K,F,B,ud]=assempde(b,p,e,t,c,a,f,u0) [K,F,B,ud]=assempde(b,p,e,t,c,a,f,u0,time) [K,F,B,ud]=assempde(b,p,e,t,c,a,f,time) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f,u0) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f,u0,time) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f,u0,time,sdl) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f,time) [K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f,time,sdl) u=assempde(K,M,F,Q,G,H,R) [K1,F1]=assempde(K,M,F,Q,G,H,R) [K1,F1,B,ud]=assempde(K,M,F,Q,G,H,R)

`assempde` is the basic Partial Differential Equation Toolbox™ function.
It assembles a PDE problem by using the FEM formulation described
in Elliptic Equations.
The command `assempde` assembles the scalar PDE
problem

for (*x*,*y*) ∊ Ω, or the system PDE problem

The command can optionally produce a solution to the PDE problem.

For the scalar case the *solution vector* *u* is
represented as a column vector of solution values at the corresponding
node points from `p`. For a system of dimension *N* with *n _{p}* node
points, the first

`u=assempde(b,p,e,t,c,a,f)` assembles
and solves the PDE problem by eliminating the Dirichlet boundary conditions
from the system of linear equations.

`[K,F]=assempde(b,p,e,t,c,a,f)` assembles
the PDE problem by approximating the Dirichlet boundary condition
with stiff springs (see Systems of PDEs for
details). `K` and `F` are the stiffness
matrix and right-hand side, respectively. The solution to the FEM
formulation of the PDE problem is `u=K\F`.

`[K,F,B,ud]=assempde(b,p,e,t,c,a,f)` assembles
the PDE problem by eliminating the Dirichlet boundary conditions from
the system of linear equations. `u1=K\F` returns
the solution on the non-Dirichlet points. The solution to the full
PDE problem can be obtained as the MATLAB^{®} expression `u=B*u1+ud`.

`[K,M,F,Q,G,H,R]=assempde(b,p,e,t,c,a,f)` gives
a split representation of the PDE problem.

`u=assempde(K,M,F,Q,G,H,R)` collapses
the split representation into the single matrix/vector form, and then
solves the PDE problem by eliminating the Dirichlet boundary conditions
from the system of linear equations.

`[K1,F1]=assempde(K,M,F,Q,G,H,R)` collapses
the split representation into the single matrix/vector form, by fixing
the Dirichlet boundary condition with large spring constants.

`[K1,F1,B,ud]=assempde(K,M,F,Q,G,H,R)` collapses
the split representation into the single matrix/vector form by eliminating
the Dirichlet boundary conditions from the system of linear equations.

`b` describes the boundary conditions
of the PDE problem. `b` can be a Boundary Condition
matrix, the name of a Boundary file, or a function handle to a Boundary
file. The formats of the Boundary Condition matrix and Boundary file
are described in the entries on `assemb` and `pdebound`,
respectively.

The geometry of the PDE problem is given by the mesh data `p`, `e`,
and t. For details on the mesh data representation, see `initmesh`.

The optional list of subdomain labels, `sdl`,
restricts the assembly process to the subdomains denoted by the labels
in the list. The optional input arguments `u0` and `time` are
used for the nonlinear solver and time stepping algorithms, respectively.
The tentative input solution vector `u0` has the
same format as `u`.

Solve the equation Δ*u* = 1 on the geometry
defined by the L-shaped membrane. Use Dirichlet boundary conditions *u* =
0 on ∂Ω. Finally plot the solution.

[p,e,t]=initmesh('lshapeg','Hmax',0.2); [p,e,t]=refinemesh('lshapeg',p,e,t); u=assempde('lshapeb',p,e,t,1,0,1); pdesurf(p,t,u)

Consider Poisson's equation on the unit circle with unit point source at the origin. The exact solution

is known for this problem. We define the function `f=circlef(p,t,u,time)` for
computing the right-hand side. `circlef` returns
zero for all triangles except for the one located at the origin; for
that triangle it returns 1/*a*, where *a* is
the triangle area. `pdedemo7` executes
an adaptive solution for this problem.

`assema` | `assemb` | `initmesh` | `pdebound` | `refinemesh`

Was this topic helpful?