Main Content

shape.Rectangle

Create rectangle centered at origin on xy-plane

Since R2023b

    Description

    The shape.Rectangle lets you create a rectangle with metal material properties on the xy-plane, centered at the origin. Use this rectangle along with the other shapes and the geometric operations to create a shape for the custom antenna.

    Creation

    Description

    rect = shape.Rectangle creates a rectangle centered at the origin and on the xy-plane.

    rect = shape.Rectangle(PropertyName=Value) sets properties using one or more name-value arguments. PropertyName is the property name and Value is the corresponding value. You can specify several name-value arguments in any order as PropertyName1=Value1, ..., PropertyNameN=ValueN. Properties that you do not specify retain their default values.

    For example, rect = shape.Rectangle(Length=4) creates a rectangle with a length of 4 m and default values for other properties.

    example

    Properties

    expand all

    Rectangle name, specified as a string.

    Example: "Rectangle1"

    Data Types: string

    Rectangle center point, specified as a two-element vector of Cartesian coordinates in meters.

    Example: [1 1]

    Data Types: double

    Rectangle length, specified as a scalar in meters.

    Example: 2

    Data Types: double

    Rectangle width, specified as a scalar in meters.

    Example: 4

    Data Types: double

    Number of discretization points per side, specified as a scalar.

    Example: 4

    Data Types: double

    Metal material of the shape, specified as a metal name string from the Metal Catalog.

    Example: "Copper"

    Data Types: string

    Color of shape, specified as either a character for color short name or a three-element real vector of RGB triplets. The default shape color is yellow. See the Types of Color Values supported by this property. When you unite two shapes of different colors, use "Individual" value to retain the colors of the original shapes in the resultant shape.

    Example: "r"

    Example: [0 0.447 0.741]

    Data Types: double | string | char

    Transparency of shape, specified as a scalar in the (0,1) range, where 0 corresponds to full transparency while 1 corresponds to full opaqueness.

    Example: 0.75

    Data Types: double

    Color of shape edges, specified as either a character for color short name or a three-element real vector of RGB triplets. The default edge color is black. See the Types of Color Values supported by this property. When you unite two shapes of different edge colors, use "Individual" value to retain the edge colors of the original shapes in the resultant shape.

    Example: "b"

    Example: [0.4940 0.1840 0.5560]

    Data Types: double | string | char

    Object Functions

    expand all

    addPerform Boolean unite operation on two shapes
    andPerform Boolean intersection operation on two shapes
    areaCalculate area of 2-D shapes in square meters
    intersectGenerate and plot intersection of two shapes
    minusCarve a shape from other shape
    plusJoin two shapes
    subtractPerform Boolean subtraction operation on two shapes
    createHoleCreate a 2-D hole on custom shape
    extrudeExtrude 2-D shape on another shape
    extrudeLinearLinearly extrude 2-D shape along specified direction
    extrudeRotateExtrude 2-D shape by angle about z-axis
    imprintShapeImprint 2-D shape on another shape
    removeSliversRemove sliver outliers from shape boundary
    rotateRotate shape about axis by angle
    rotateXRotate shape about x-axis by angle
    rotateYRotate shape about y-axis by angle
    rotateZRotate shape about z-axis by angle
    scaleChange size of shape by fixed factor
    translateMove shape to new location
    getShapeVerticesFind shape vertices
    meshGenerate and view mesh for antennas, arrays, and custom shapes
    plotPlot boundary of 2-D shape
    showDisplay antenna, array structures, shapes, or platform

    Examples

    collapse all

    Create a 3 cm by 2 cm rectangular patch of copper material. Rotate it by 45 degrees around the z-axis. Manually mesh it and view the structure.

    rect = shape.Rectangle(Length=0.03,Width=0.02,Metal="Copper");
    rotateZ(rect,45);

    Figure contains an axes object. The axes object with xlabel x (mm), ylabel y (mm) contains 2 objects of type patch.

    mesh(rect,MaxEdgeLength=5e-3)

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

    Version History

    Introduced in R2023b