Main Content

area

R2026b

Compute area of 2-D mesh elements

Description

A = area(mesh) returns the area A of the entire mesh.

example

[A,AE] = area(mesh) also returns a row vector AE containing areas of each individual element of the mesh.

example

A = area(mesh,elements) returns the combined area of the specified elements of the mesh.

example

Examples

collapse all

Generate a 2-D mesh and find its area.

Create and plot the geometry using the built-in function lshapeg.

g = fegeometry(@lshapeg);
pdegplot(g,FaceLabels="on")

L-shaped geometry plot with three face labels F1, F2, and F3 identifying the rectangular faces.

Generate a mesh and plot it.

g = generateMesh(g);
pdemesh(g)

Triangular mesh of an L-shaped geometry.

Compute the area of the entire mesh.

ma = area(g.Mesh)
ma = 
3.0000

Generate a 2-D mesh and find the area of each element.

Create and plot the geometry using the built-in function lshapeg.

g = fegeometry(@lshapeg);
pdegplot(g,FaceLabels="on")

L-shaped geometry plot with three face labels F1, F2, and F3 identifying the rectangular faces.

Generate a mesh and plot it.

g = generateMesh(g);
pdemesh(g)

Triangular mesh of an L-shaped geometry.

Compute the area of the entire mesh and the area of each individual element of the mesh. Display the areas of the first 5 elements.

[ma,mi] = area(g.Mesh);
mi(1:5)
ans = 1×5

    0.0054    0.0054    0.0050    0.0055    0.0055

Find the combined area of the elements associated with a particular face of a 2-D mesh.

Create and plot the geometry using the built-in function lshapeg.

g = fegeometry(@lshapeg);
pdegplot(g,FaceLabels="on")

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

Generate a mesh and plot it.

g = generateMesh(g);
pdemesh(g)

Figure contains an axes object. The axes object contains 2 objects of type line.

Find the elements associated with face 1 and compute the total area of these elements.

Ef1 = findElements(g.Mesh,"region",Face=1);
maf1 = area(g.Mesh,Ef1)
maf1 = 
1

Find how much of the total mesh area belongs to these elements. Return the result as a percentage.

maf1_percent = maf1/area(g.Mesh)*100
maf1_percent = 
33.3333

Input Arguments

collapse all

Mesh description, specified as an FEMesh object.

Element IDs, specified as a positive integer or a matrix of positive integers.

Example: [10 68 81 97 113 130 136 164]

Output Arguments

collapse all

Area of the entire mesh or the combined area of the specified elements of the mesh, returned as a positive number.

Areas of individual elements, returned as a row vector of positive numbers.

Version History

Introduced in R2018a