Contenido principal

MeshReader

R2026b

Read properties of mesh

Since R2026b

    Description

    The MeshReader object stores the properties of the mesh such as the points, triangles, and tetrahedra in the mesh, edge lengths of the triangles, growth rate, and mesh quality. You can use this information to fine tune the mesh for your application. You can also visualize the mesh of the metal region, dielectric region, or the entire antenna or array structure and detect bad features in the mesh.

    Creation

    You can create the MeshReader object using the mesh function. There are two ways to create this object:

    • Run any port, surface, or field analysis on the antenna or array to automatically generate the mesh. Then use m = mesh(object) syntax to create the MeshReader object.

    • Manually mesh the antenna or array by setting MaxEdgeLength property of the mesh to create the MeshReader object. For example, m = mesh(object,MaxEdgeLength=0.01) creates a MeshReader object.

    Properties

    expand all

    This property is read-only.

    Cartesian coordinates of points in mesh, returned as a 3-by-N matrix double. N represents the number of points and each column of the matrix represents x, y, and z-coordinates of the points.

    Example: [-0.0188 -1e-3 0; -0.0375 -0.0188 0]'

    Data Types: double

    This property is read-only.

    Mesh triangles connectivity list, specified as a 4-by-N integer matrix, where N is the number of triangles in the mesh. First three rows of each column in Triangles contains the vertex IDs that define a triangle. The vertex IDs are the column numbers of the Points property. The ID of a triangle in the mesh is the corresponding column number in the Triangles property.

    Example: [96 97 146 1;...;1 293 294 2]'

    Data Types: double

    This property is read-only.

    Mesh tetrahedra connectivity list, specified as a 4-by-N integer matrix, where N is the number of tetrahedra in the mesh. Each column of Tetrahedra contains the vertex IDs that define a tetrahedron. The vertex IDs are the column numbers of the Points property. The ID of a tetrahedron in the mesh is the corresponding column number in the Tetrahedra property. This property has an empty value for the antennas without a dielectric substrate.

    Example: [96 97 146 438;...;12 547 305 304]'

    Data Types: double

    This property is read-only.

    Maximum edge length of mesh triangles, returned as a positive scalar in meters.

    Example: 0.01

    Data Types: double

    This property is read-only.

    Minimum edge length of mesh triangles, returned as a positive scalar in meters.

    Example: 2e-3

    Data Types: double

    This property is read-only.

    Gradation in the triangle sizes of the mesh, returned as a scalar in the range (0,1).

    Example: GrowthRate=0.7 states that the growth rate of the mesh is 70 percent.

    Data Types: double

    This property is read-only.

    When solver type is MoM a measure of degree of structural similarity of the mesh triangles to an equilateral triangle. MinimumMeshQuality is the lowest observed mesh quality out of all the mesh triangles, returned as a scalar in the range (0,1). A minimum mesh quality of 1 means all the mesh triangles are equilateral.

    When solver type is FEM, the measure of lowest mesh quality out of all mesh tetrahedra. A minimum mesh quality of 1 means all the mesh tetrahedra are regular.

    Example: MinimumMeshQuality=0.72 states that the lowest quality triangle in the mesh is 72 percent similar to an equilateral triangle.

    Data Types: double

    This property is read-only.

    Mode of mesh creation, returned as either "auto" or "manual". The MeshMode is "auto" when the mesh gets created due to running any analysis function on the antenna or array. The MeshMode is "manual" when the mesh is created by specifying the MaxEdgeLength value in the mesh function run on an antenna, array, or custom geometry.

    Example: MeshMode="manual"

    Data Types: string

    This property is read-only.

    Degree of structural similarity of all mesh tetrahedra to a regular tetrahedron, returned as a list in the range (0,1) for every tetrahedron in the mesh. A value of 1 indicates regular tetrahedra. TetElementQuality is only available when solver type is FEM.

    Data Types: double

    Object Functions

    showDielectricSurfaceMesh (Antenna Toolbox)Display dielectric surface mesh of antenna or array
    showDielectricVolumeMesh (Antenna Toolbox)Display dielectric volume mesh of antenna or array
    showMeshAll (Antenna Toolbox)Display complete metal-dielectric mesh of antenna or array
    showMetalMesh (Antenna Toolbox)Display metal mesh of antenna or array
    showDuplicateVertices (Antenna Toolbox)Highlight duplicate vertices in STL file or mesh
    showFreeTriangles (Antenna Toolbox)Highlight free triangles in STL file or mesh
    showNonManifoldEdges (Antenna Toolbox)Highlight non-manifold edges in STL file or mesh
    showNonManifoldVertices (Antenna Toolbox)Highlight non-manifold vertices in STL file or mesh
    showNormalTransitionEdges (Antenna Toolbox)Highlight normal transition edges in STL file or mesh
    showSlivers (Antenna Toolbox)Highlight slivers in STL file or mesh
    showTVertices (Antenna Toolbox)Highlight T-vertices in STL file or mesh

    Examples

    collapse all

    This example shows how to read mesh parameters of a microstrip line pcb component and view the complete mesh for the default MoM solver and the FEM solver.

    Create Microstrip Line Pcb Component

    Create a microstrip line pcb component. Run Sparameter analysis using the default MoM solver on this component at 1.67 GHz to automatically generate the mesh.

    micro_strip_line=microstripLine();
    pcb=pcbComponent(micro_strip_line);
    figure
    sparam=sparameters(pcb,1.67e9);
    figure
    rfplot(sparam)

    Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude (dB) contains 4 objects of type line. These objects represent dB(S_{11}), dB(S_{21}), dB(S_{12}), dB(S_{22}).

    Read Mesh Parameters of Pcb Component

    Read the mesh parameters such as number of points, triangles, and tetrahedra, maximum and minimum edge length, mesh growth rate, and quality using the MeshReader (Antenna Toolbox) object.

    m = mesh(pcb)
    m = 
      MeshReader with properties:
    
                    Points: [3×110 double]
                 Triangles: [4×134 double]
                Tetrahedra: [4×276 double]
             MaxEdgeLength: 0.0455
             MinEdgeLength: 0.0086
                GrowthRate: 0.5800
        MinimumMeshQuality: 0.6440
                  MeshMode: 'auto'
    
    

    View Mesh of Pcb Component

    View the metal mesh.

    figure
    showMetalMesh(m)

    Figure contains an axes object. The axes object with title Metal mesh, xlabel x (m), ylabel y (m) contains an object of type patch. This object represents PEC.

    View the dielectric surface mesh.

    figure
    showDielectricSurfaceMesh(m)

    Figure contains an axes object. The axes object with title Dielectric surface, xlabel x (m), ylabel y (m) contains an object of type patch.

    View the dielectric volume mesh.

    figure
    showDielectricVolumeMesh(m)

    Figure contains an axes object. The axes object with title Dielectric volume, xlabel x (m), ylabel y (m) contains an object of type patch.

    View the overall mesh.

    figure
    showMeshAll(m)

    Figure contains an axes object. The axes object with title Metal-Dielectric, xlabel x (m), ylabel y (m) contains 2 objects of type patch. This object represents PEC.

    showMeshAll(m)

    Figure contains an axes object. The axes object with title Metal-Dielectric, xlabel x (m), ylabel y (m) contains 2 objects of type patch. This object represents PEC.

    Read Mesh Parameters of a Pcb Component for FEM Solver

    This example shows how to read mesh parameters of a microstrip line pcb component and view the complete mesh for the FEM solver.

    Create Microstrip Line Pcb Component

    Create a microstrip line pcb component. Run Sparameter analysis using the FEM solver on this component at 1.67 GHz to automatically generate the mesh.

    micro_strip_line=microstripLine();
    pcb=pcbComponent(micro_strip_line);
    pcb.SolverType = 'FEM';
    pcb.Connector = design(RFConnector,pcb);
    figure
    sparam=sparameters(pcb,1.67e9);
    figure
    rfplot(sparam)

    Figure contains an axes object. The axes object with xlabel Frequency (GHz), ylabel Magnitude (dB) contains 4 objects of type line. These objects represent dB(S_{11}), dB(S_{21}), dB(S_{12}), dB(S_{22}).

    Read Mesh Parameters of Pcb Component

    Read the mesh parameters such as number of points, triangles, and tetrahedra, maximum and minimum edge length, mesh growth rate, and element quality per tet elements using the MeshReader (Antenna Toolbox) object.

    m = mesh(pcb)
    m = 
      MeshReader with properties:
    
                    Points: [3×6147 double]
                 Triangles: [4×1054 double]
                Tetrahedra: [10×4161 double]
             MaxEdgeLength: 0.0449
             MinEdgeLength: 1.0000e-09
                GrowthRate: 0.5000
        MinimumMeshQuality: 0.2094
                  MeshMode: 'auto'
         TetElementQuality: [0.7843 0.6211 0.5969 0.5879 0.5047 0.5073 0.3740 0.7914 0.7857 0.6593 0.5321 0.4530 0.5125 0.5522 0.6345 0.4914 0.5710 0.7033 0.5045 0.8190 0.8095 0.8145 0.5805 0.7335 0.6325 0.8240 0.6841 0.6585 0.8035 0.4787 … ] (1×4161 double)
    
    

    View Mesh of Pcb Component

    View the mesh used by the FE solver.

    figure
    mesh(pcb)

    Figure contains an axes object and an object of type uicontrol. The axes object with title Metal-Dielectric, xlabel x (m), ylabel y (m) contains 8 objects of type patch, surface. These objects represent PEC, feed, Feed conductor, Feed dielectric, Feed flange.

    Tips

    The MeshReader object stores the triangulation information of the mesh in the form of points and triangles connectivity list. This allows stlFileChecker (Antenna Toolbox) functions to be directly used on the MeshReader object to detect and display bad features of the mesh. For example, below code shows the detection and display of T-Vertices in the mesh of a microstrip patch antenna operating at 1.67 GHz.

    ant = patchMicrostrip(Conductor=metal("Copper"),... 
               Substrate=dielectric("FR4"));
    impedance(ant,1.67e9);
    m = mesh(ant)
    detectTVertices(m);
    m.TVertices
    showTVertices(m)

    Alternatively, you can write the mesh data to a STL file using stlwrite (Antenna Toolbox) function and then run stlFileChecker on that STL file to detect bad features of the mesh. For example, below code shows the detection of all the bad features in the mesh by converting the mesh data to a STL file using stlwrite (Antenna Toolbox) function and running stlFileChecker on that data. Once all the bad features are detected, you can choose individual feature to be highlighted on the mesh plot using functions of the stlFileChecker object.

    ant = patchMicrostrip(Conductor=metal("Copper"),...
                  Substrate=dielectric("FR4"));
    impedance(ant,1.67e9);
    m = mesh(ant)
    tr = triangulation(m.Triangles(1:3,:)',...
              m.Points(:,1:max(unique(m.Triangles(1:3,:)))')');
    stlwrite(tr,"sampleFile.stl");
    stlFileChecker("sampleFile.stl")

    Version History

    Introduced in R2026b

    See Also

    Functions

    Objects

    Topics