主要内容

pdeeig

(Not recommended) Solve eigenvalue PDE problem

pdeeig is not recommended. Use solvepdeeig instead.

Description

[v,l] = pdeeig(model,c,a,d,r) produces the solution to the FEM formulation of the scalar PDE eigenvalue problem

(cu)+au=λdu on Ω

or the system PDE eigenvalue problem

(cu)+au=λdu on Ω

with geometry, boundary conditions, and mesh specified in model, a PDEModel object.

The eigenvalue PDE problem is a homogeneous problem, i.e., only boundary conditions where g = 0 and r = 0 can be used. The nonhomogeneous part is removed automatically.

example

[v,l] = pdeeig(b,p,e,t,c,a,d,r) solves for boundary conditions described in b, and the finite element mesh in [p,e,t].

example

[v,l] = pdeeig(Kc,B,M,r) produces the solution to the generalized sparse matrix eigenvalue problem

Kc ui = λB´MBui
u = Bui

with Real(λ) in the interval r.

example

Examples

collapse all

Compute the eigenvalues that are less than 100, and compute the corresponding eigenmodes for -u=λu on the geometry of the L-shaped membrane.

model = createpde;
geometryFromEdges(model,@lshapeg);
applyBoundaryCondition(model,'edge',1:model.Geometry.NumEdges,'u',0);
generateMesh(model,'GeometricOrder','linear','Hmax',0.02);
c = 1;
a = 0;
d = 1;
r = [-Inf 100];
[v,l] = pdeeig(model,c,a,d,r);
l(1)                    % first eigenvalue
ans = 
19.7491

Display the first eigenmode, and compare it to the built-in membrane plot.

pdeplot(model,'XYData',v(:,1),'ZData',v(:,1))

Figure contains an axes object. The axes object contains an object of type patch.

figure 
membrane(1,20,9,9)      % the MATLAB function

Figure contains an axes object. The axes object contains an object of type surface.

Compute the sixteenth eigenvalue, and plot the sixteenth eigenmode.

l(16)                   % sixteenth eigenvalue
ans = 
98.9431
figure
pdeplot(model,'XYData',v(:,16),'ZData',v(:,16))    % sixteenth eigenmode

Figure contains an axes object. The axes object contains an object of type patch.

Compute the eigenvalues that are less than 100, and compute the corresponding eigenmodes for -u=λu on the geometry of the L-shaped membrane, using the legacy syntax.

Use the geometry in lshapeg. For more information about this syntax, see Parameterized Function for 2-D Geometry Creation.

g = @lshapeg;
pdegplot(g,'EdgeLabels','on')
axis equal
ylim([-1.1,1.1])

Figure contains an axes object. The axes object contains 11 objects of type line, text.

Set zero Dirichlet boundary conditions using the lshapeb function.

b = @lshapeb;

Set coefficients c = 1, a = 0, and d = 1. Collect eigenvalues up to 100.

c = 1;
a = 0;
d = 1;
r = [-Inf 100];

Generate a mesh and solve the eigenvalue problem.

[p,e,t] = initmesh(g,'Hmax',0.02);
[v,l] = pdeeig(b,p,e,t,c,a,d,r);

Find the first eigenvalue.

l(1)
ans = 
9.6481

Import a simple 3-D geometry and find eigenvalues and eigenvectors from the associated finite element matrices.

Create a model and import the BracketWithHole.stl geometry.

model = createpde();
importGeometry(model,'BracketWithHole.stl');
figure
pdegplot(model,'FaceLabels','on')
view(30,30)
title('Bracket with Face Labels')

Figure contains an axes object. The axes object with title Bracket with Face Labels contains 6 objects of type quiver, text, patch, line.

figure
pdegplot(model,'FaceLabels','on')
view(-134,-32)
title('Bracket with Face Labels, Rear View')

Figure contains an axes object. The axes object with title Bracket with Face Labels, Rear View contains 6 objects of type quiver, text, patch, line.

Set coefficients c = 1, a = 0, and d = 1. Collect eigenvalues that are less than 100.

c = 1;
a = 0;
d = 1;
r = [-Inf 100];

Generate a mesh for the model.

generateMesh(model);

Create the associated finite element matrices.

[Kc,~,B,~] = assempde(model,c,a,0);
[~,M,~] = assema(model,0,d,0);

Solve the eigenvalue problem.

[v,l] = pdeeig(Kc,B,M,r);

Look at the first two eigenvalues.

l([1,2])
ans = 2×1

   -0.0000
   42.8014

Plot the solution corresponding to eigenvalue 2.

pdeplot3D(model,'ColorMapData',v(:,2))

Figure contains an axes object. The hidden axes object contains 5 objects of type patch, quiver, text.

Input Arguments

collapse all

PDE model, specified as a PDEModel object.

Example: model = createpde

PDE coefficient, specified as a scalar, matrix, character vector, character array, string scalar, string vector, or coefficient function. c represents the c coefficient in the scalar PDE

(cu)+au=λdu on Ω

or the system PDE eigenvalue problem

(cu)+au=λdu on Ω

Example: 'cosh(x+y.^2)'

Data Types: double | char | string | function_handle
Complex Number Support: Yes

PDE coefficient, specified as a scalar, matrix, character vector, character array, string scalar, string vector, or coefficient function. a represents the a coefficient in the scalar PDE

(cu)+au=λdu on Ω

or the system PDE eigenvalue problem

(cu)+au=λdu on Ω

Example: 2*eye(3)

Data Types: double | char | string | function_handle
Complex Number Support: Yes

PDE coefficient, specified as a scalar, matrix, character vector, character array, string scalar, string vector, or coefficient function. d represents the d coefficient in the scalar PDE

(cu)+au=λdu on Ω

or the system PDE eigenvalue problem

(cu)+au=λdu on Ω

Example: 2*eye(3)

Data Types: double | char | string | function_handle
Complex Number Support: Yes

Eigenvalue range, specified as a two-element real vector. Real parts of eigenvalues λ fall in the range r(1) ≤ λ ≤ r(2). r(1) can be -Inf. The algorithm returns all eigenvalues in this interval in the l output, up to a maximum of 99 eigenvalues.

Example: [-Inf,100]

Data Types: double

Boundary conditions, specified as a boundary matrix or boundary file. Pass a boundary file as a function handle or as a file name. A boundary matrix is generally an export from the PDE Modeler app.

Example: b = 'circleb1', b = "circleb1", or b = @circleb1

Data Types: double | char | string | function_handle

Mesh points, specified as a 2-by-Np matrix of points, where Np is the number of points in the mesh. For a description of the (p,e,t) matrices, see Mesh Data as [p,e,t] Triples.

Typically, you use the p, e, and t data exported from the PDE Modeler app, or generated by initmesh or refinemesh.

Example: [p,e,t] = initmesh(gd)

Data Types: double

Mesh edges, specified as a 7-by-Ne matrix of edges, where Ne is the number of edges in the mesh. For a description of the (p,e,t) matrices, see Mesh Data as [p,e,t] Triples.

Typically, you use the p, e, and t data exported from the PDE Modeler app, or generated by initmesh or refinemesh.

Example: [p,e,t] = initmesh(gd)

Data Types: double

Mesh triangles, specified as a 4-by-Nt matrix of triangles, where Nt is the number of triangles in the mesh. For a description of the (p,e,t) matrices, see Mesh Data as [p,e,t] Triples.

Typically, you use the p, e, and t data exported from the PDE Modeler app, or generated by initmesh or refinemesh.

Example: [p,e,t] = initmesh(gd)

Data Types: double

Stiffness matrix, specified as a sparse matrix or as a full matrix. See Elliptic Equations. Typically, Kc is the output of assempde.

Dirichlet nullspace, returned as a sparse matrix. See Algorithms. Typically, B is the output of assempde.

Mass matrix. specified as a sparse matrix or a full matrix. See Elliptic Equations.

To obtain the input matrices for pdeeig, hyperbolic or parabolic, run both assema and assempde:

[Kc,Fc,B,ud] = assempde(model,c,a,f);
[~,M,~] = assema(model,0,d,f);

Note

Create the M matrix using assema with d, not a, as the argument before f.

Data Types: double
Complex Number Support: Yes

Output Arguments

collapse all

Eigenvectors, returned as a matrix. Suppose

  • Np is the number of mesh nodes

  • N is the number of equations

  • ev is the number of eigenvalues returned in l

Then v has size Np*N-by-ev. Each column of v corresponds to the eigenvectors of one eigenvalue. In each column, the first Np elements correspond to the eigenvector of equation 1 evaluated at the mesh nodes, the next Np elements correspond to equation 2, etc.

Note

Eigenvectors are determined only up to multiple by a scalar, including a negative scalar.

Eigenvalues, returned as a vector. The real parts of l are in the interval r. The real parts of l are monotone increasing.

Limitations

In the standard case c and d are positive in the entire region. All eigenvalues are positive, and 0 is a good choice for a lower bound of the interval. The cases where either c or d is zero are discussed next.

  • If d = 0 in a subregion, the mass matrix M becomes singular. This does not cause any trouble, provided that c > 0 everywhere. The pencil (K,M) has a set of infinite eigenvalues.

  • If c = 0 in a subregion, the stiffness matrix K becomes singular, and the pencil (K,M) has many zero eigenvalues. With an interval containing zero, pdeeig goes on for a very long time to find all the zero eigenvalues. Choose a positive lower bound away from zero but below the smallest nonzero eigenvalue.

  • If there is a region where both c = 0 and d = 0, we get a singular pencil. The whole eigenvalue problem is undetermined, and any value is equally plausible as an eigenvalue.

Some of the awkward cases are detected by pdeeig. If the shifted matrix is singular, another shift is attempted. If the matrix with the new shift is still singular a good guess is that the entire pencil (K,M) is singular.

If you try any problem not belonging to the standard case, you must use your knowledge of the original physical problem to interpret the results from the computation.

Tips

  • The equation coefficients cannot depend on the solution u or its gradient.

Algorithms

collapse all

Version History

Introduced before R2006a

collapse all

See Also