Main Content


Create rectangle centered at origin on xy-plane


Use the antenna.Rectangle object to create a rectangle centered at the origin and on the xy-plane. You can use antenna.Rectangle to create single-layer or multi-layered antennas using pcbStack.




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


rect = antenna.Rectangle(Name=Value) creates a rectangle, with additional propertiesProperties specified by one or more name-value arguments. Name is the property name and Value is the corresponding value. You can specify several name-value arguments in any order as Name1=Value1, ..., NameN=ValueN. Properties that you do not specify retain their default values.


expand all

Name of rectangle, specified as a string.

Example: "Rect1"

Data Types: string

Cartesian coordinates of center of rectangle, specified as a 2-element vector in meters.

Example: [0.006 0.006]

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: 16

Data Types: double

Object Functions

addBoolean unite operation on two shapes
subtractBoolean subtraction operation on two shapes
intersectIntersection of shape1 and shape2
plusJoin two shapes
minusCarve a shape from other shape
andBoolean intersection operation on two shapes
areaCalculate area of 2-D shapes in square meters
showDisplay antenna, array structures, shapes, or platform
plotPlot boundary of 2-D shape
meshMesh properties of metal, dielectric antenna, or array structure
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
translateMove shape to new location
scaleChange size of shape by fixed factor
mirrorXMirror shape along x-axis
mirrorYMirror shape along y-axis
removeHolesRemove holes from shape
removeSliversRemove sliver outliers from boundary of shape


collapse all

Create a rectangle shape using antenna.Rectangle and view it.

r1 = antenna.Rectangle
r1 = 
  Rectangle with properties:

         Name: 'myrectangle'
       Center: [0 0]
       Length: 1
        Width: 2
    NumPoints: 2


Create and view a rectangle with a length of 2 m and a width of 4 m.

r2 = antenna.Rectangle(Length=2,Width=4);
axis equal

Rotate the rectangle.



Create a rectangle with a length of 0.15 m, and a width of 0.15 m.

r  = antenna.Rectangle(Length=0.15,Width=0.15);

Create a second rectangle with a length of 0.05 m, and a width of 0.05 m. Set the center of the second rectangle at half the length of the first rectangle r.

n = antenna.Rectangle(Center=[0.075,0],Length=0.05,Width=0.05);

Create and view a notched rectangle by subtracting n from r.

rn  = r-n;

Calculate the area of the notched rectangle.

ans = 0.0212

Version History

Introduced in R2017a