%% Design and Analyze X-Band Custom PCB Patch Antenna
% Type this command at the command line to open the PCB Antenna Designer app.
% pcbAntennaDesigner
% On the Design tab click New Session to start a new session and open a blank canvas.
%
% The default units for the canvas are in millimeters (mm). The app uses global units and you can change the units using the Canvas Settings button.
%% Define Board Shape
% Select Rectangle from the Shapes section on the toolbar. Drag the shape on the canvas to create a rectangle and change the properties of Rectangle1 in the Properties pane to the following:
% Center — [0,0]
% Length — 20
% Width — 20
%
%% Add Ground Plane
% Click Add Layer on the toolbar and then select Metal Layer. The shape of the board is represented as a dotted line on the canvas. Rename this layer to metalGround and then change the default color to [0.93 0.69 0.13].
% The default metal type is PEC. To change the metal type, select Layers and then select a metal from the Type drop-down list. Use the default metal type for this example.
%
%  Select Rectangle from the Shapes section and drag the shape on the canvas to create a rectangular ground plane. Set the properties of the ground plane to the following
% Name — gndplane
% Center — [0,0]
% Length — 20
% Width — 20
%
%% Add Dielectric Layer
% Click Add Layer and then select Dielectric Layer to create a dielectric layer. A dielectric layer is created with the dimensions of the board shape. Set the properties of the layer to the following:
% Name — dielectricFR4
% DielectricType — FR4
% Color — [0.47 0.67 0.19]
% Transparency — 0.5
% Thickness — 0.6
%
%% Create Polygon Patch
% Click Add Layer and then select Metal Layer. Rename the metal layer to metalPatch.
%
% Select Polygon from the Shapes section. Select the vertices on the canvas to create a polygon patch. Set the properties of the polygon to the following:
% Name — polygonPatch
% Angle — 0
% Under Vertices set the following values:
%  x1 = –2.5489 and y1 = 2.9902,
%  x2 = 5.0296 and y2 = 5.6928,
%  x3 = 4.9478 and y3 = –1.4050,
%  x4 = –2.9305 and y4 = –3.5343,
%  x5 = –2.5489 and y5 = 2.3623 and
%  x6 = –2.5216 and y1 = 2.6899
%
%% Add Feed
% Click Add Feed from the Feed Via section on the toolbar. Set the properties of the feed to the following:
% Name — Feed1
% StartLayer — metalGround
% StopLayer — metalPatch
% Center — [– 0.5 0.5]
%
%% Validate Your Design
% Click Validate Design on the toolbar to validate your board shape, layers, feed, via, and load.
%
%% Analyze Your Design
% In the Analysis tab, set Center Frequency to 8.9 GHz and Frequency Range to 2:4:0.5:12. Click S-parameters under the Vector Frequency Analysis section to plot the reflection coefficient of the PCB patch antenna. The PCB patch antenna resonates at 8.9 GHz.
%
% This examples employs adding a slot to shift the resonant frequency. To add a circular slot, in the Design tab, select metalPatch and then select the Circle in the Shapes. Set the properties of the circle to the following:
% Name — slot
% Center — [2.24675 2.88105]
% Radius — 0.5
%
% Select the polygonPatch and the slot you created in the previous step and then select Subtract on the toolbar.
%
% In the Analysis tab, set Center Frequency to 9.4 GHz and click Update Plots. The PCB patch antenna now resonates at 9.4 GHz.
%
% Click 3D Pattern in the Scalar Frequency Analysis section to plot the 3-D radiation pattern. The directivity of the PCB patch antenna is 3.69 dBi.
%
% Copyright 2020 The MathWorks, Inc.