MATLAB Examples

Numerically solve a Poisson's equation, compare the numerical solution with the exact solution, and refine the mesh until the solutions are close.

Calculate the deflection of a structural plate acted on by a pressure loading.

Solve the heat equation with a source term.

Analyze a 3-D axisymmetric model by using a 2-D model.

Solve a Poisson's equation with a delta-function point source on the unit disk using the adaptmesh function.

Solve a coupled elasticity-electrostatics problem.

Perform a heat transfer analysis of a thin plate.

Calculate the vibration modes and frequencies of a 3-D simply supported, square, elastic plate.

Analyze the dynamic behavior of a beam clamped at both ends and loaded with a uniform pressure load.

Solve a Helmholtz equation using the solvepde function.

Calculate the vibration modes of a circular membrane by using the MATLAB eigs function.

Calculate eigenvalues and eigenvectors using the programmatic workflow. For the PDE Modeler app solution, see Eigenvalues and Eigenmodes of the L-Shaped Membrane: PDE App .

Compute the eigenvalues and eigenmodes of a square domain using the programmatic workflow. For the PDE Modeler app solution, see Eigenvalues and Eigenmodes of a Square .

Solve for the heat distribution in a block with cavity using the programmatic workflow. For the PDE Modeler app solution, see Heat Equation for a Block with Cavity: PDE App .

Perform modal and transient analysis of a tuning fork.

Perform a 2-D plane-stress elasticity analysis.

Solve a coupled thermo-elasticity problem. Thermal expansion or contraction in mechanical components and structures occurs due to temperature changes in the operating environment.

Analyze a 3-D mechanical part under an applied load using finite element analysis (FEA) and determine the maximal deflection.

Create a cardioid geometry using four distinct techniques. The techniques are ways to parametrize your geometry using arc length calculations. The cardioid satisfies the equation .

Solve the wave equation using the solvepde function.

Solve the heat equation with a temperature-dependent thermal conductivity.

A PDE model stores initial conditions in its InitialConditions property. Suppose model is the name of your model. Obtain the initial conditions:

Import a 3-D mesh into a PDE model. Importing a mesh creates the corresponding geometry in the model.

A PDE model stores coefficients in its EquationCoefficients property. Suppose model is the name of your model. Obtain the coefficients:

A PDE model stores boundary conditions in its BoundaryConditions property. To obtain the boundary conditions stored in the PDE model called model , use this syntax:

There are two types of boundaries:

Create a polygonal geometry using the MATLAB polyshape function. Then use the triangulated representation of the geometry as an input mesh for the geometryFromMesh function.

The following figure shows how the direction of parameter increase relates to label numbering. The arrows in the figure show the directions of increasing parameter values. The black dots

Write a geometry function for creating a circular region. Parametrize a circle with radius 1 centered at the origin (0,0), as follows:

Create a geometry file for a region with subdomains and a hole. It uses the "Analytic Arc Length" section of the "Arc Length Calculations for a Geometry Function" example and a variant of the

The generateMesh function creates a triangular mesh for a 2-D geometry and a tetrahedral mesh for a 3-D geometry. By default, the mesh generator uses internal algorithms to choose suitable

Include additional parameters into a function for creating a 2-D geometry.

Partial Differential Equation Toolbox™ allows you to find mesh elements and nodes by their geometric location or proximity to a particular point or node. This example works with a group of

Partial Differential Equation Toolbox™ uses the finite element method to solve PDE problems. This method discretizes a geometric domain into a collection of simple shapes that make up a

Create contour slices in various directions through a solution in 3-D geometry.

Calculate the approximate gradients of a solution, and how to use those gradients in a quiver plot or streamline plot.

Obtain a surface plot of a solution with 3-D geometry and N > 1.

Obtain plots from 2-D slices through a 3-D geometry.

This examples conducts a parametric study in which heat conduction simulation is performed over a set of similar geometries to determine which geometry "best" meets an average temperature

Analyze an idealized 3-D mechanical part under an applied loading using Finite Element Analysis (FEA). The objective of the analysis is to determine the maximum deflection caused by the

Calculate the deflection of a structural plate acted on by a pressure loading using the Partial Differential Equation Toolbox™.

Include damping in the transient analysis of a simple cantilever beam.

Solve a nonlinear elliptic problem.

Perform a 3-D transient heat conduction analysis of a hollow sphere made of three different layers of material.

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Contact your local office