Generated banner for Matlab Design Antenna
Generated logo for Matlab Design Antenna

Matlab Design Antenna

MathWorksOfficialCreated by MathWorks

  • Skill
  • Tool integration
  • Science and research
  • BSD-2-Clause
  • No issues found

From the author

Design antennas, arrays, and PCB antennas using MATLAB Antenna Toolbox. Covers catalog antenna design and pattern analysis, custom antenna construction (customAntenna + shape.*), PCB antenna design (pcbStack + antenna.*), finite and infinite array design, AI-accelerated design exploration (AIAntenna, patternFromAI), and optimization (SADEA/TR-SADEA). Use when the user wants to design, create, model, analyze, optimize, or fabricate an antenna or array.
— the description by MathWorks

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a comprehensive framework for antenna engineering within the MATLAB environment. It covers the full lifecycle of antenna development, including catalog-based design, custom geometry construction, multi-layer PCB stackups, and complex array configurations. The skill integrates advanced capabilities such as AI-accelerated design exploration using surrogate models and automated optimization routines (SADEA/TR-SADEA) to refine performance metrics like gain, bandwidth, and sidelobe levels. It is intended for engineers performing electromagnetic modeling, analysis, and fabrication preparation.

What it does

  • Automates the design of standard catalog antennas based on frequency and substrate requirements.
  • Enables construction of custom 3D antenna geometries using geometric primitives and boolean operations.
  • Supports multi-layer PCB antenna stackup design with Gerber file export for fabrication.
  • Models finite and infinite antenna arrays with support for beam steering and amplitude tapering.
  • Accelerates design space exploration using pretrained AI surrogate models.
  • Performs geometric and performance optimization using surrogate-assisted algorithms.

When to use it

  • When you need to design a standard antenna element at a specific operating frequency.
  • When creating custom antenna structures or complex multi-layer PCB antenna designs.
  • When analyzing array performance, including mutual coupling, beam steering, and scan blindness.
  • When you need to optimize antenna dimensions to meet specific gain or bandwidth targets.
  • When performing rapid parametric sweeps using AI-accelerated surrogate models.

Advantages

  • Seamless integration with MATLAB's computational and visualization environment.
  • Reduces simulation time for design exploration via AI surrogate models.
  • Provides built-in optimization routines specifically tuned for antenna performance metrics.
  • Supports industry-standard fabrication outputs like Gerber files for PCB antennas.
  • Handles complex array analysis including infinite array Floquet boundary conditions.

Usage examples

“Design a patch antenna for 2.4 GHz on an FR4 substrate.”
The agent will set the substrate to FR4, instantiate a patchMicrostrip antenna, apply the design() function for the 2.4 GHz frequency, and provide the resulting dimensions.
“Create a 4x4 rectangular array of dipoles at 5 GHz.”
The agent will configure a rectangularArray, set the size to [4, 4], and use design() with a dipole element to calculate the appropriate spacing and dimensions for 5 GHz.
“Optimize the length and width of a patch antenna for maximum gain.”
The agent will set up an optimization routine using the optimize() function, defining the patch dimensions as variables and gain as the objective function.
“How do I build a custom antenna using a cylinder and a box?”
The agent will guide you to use the shape.* namespace to define the primitives, apply boolean operations to combine them, and use customAntenna to assemble the final structure with a feed.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/matlab/matlab-design-antenna/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip matlab-design-antenna.zip -d .agents/skills

Documentation by MathWorks

Antenna and Array Design

Design, analyze, and optimize antennas and arrays using MATLAB Antenna Toolbox — from catalog elements to custom shapes, PCB fabrication, AI-accelerated exploration, and surrogate-assisted optimization.

When to Use

Catalog antenna design

  • Design a standard antenna at a frequency (dipole, patch, horn, helix, Yagi, etc.)

  • Analyze radiation pattern (3D, 2D cuts, polarization, beamwidth, sidelobes)

  • Compute impedance, S-parameters, or return loss

  • Set substrate material before design

  • Compare patterns across antennas or frequencies

Custom antenna design

  • Build non-catalog antennas from geometric primitives (shape.*)

  • Construct 3D structures (waveguides, horns, cavities) via extrusion

  • Import STL/CAD geometry and add feeds

  • Configure delta-gap or probe feeds on custom structures

PCB antenna design

  • Build multi-layer PCB antenna stackups (pcbStack)

  • Create custom metal patterns with boolean operations (antenna.*)

  • Configure probe, edge, or aperture-coupled feeds

  • Export Gerber files for fabrication

  • Convert catalog antennas to pcbStack

Array design

  • Design linear, rectangular, circular, or conformal arrays

  • Beam steering, amplitude tapering, grating lobe analysis

  • Infinite array analysis (scan impedance, scan blindness, Floquet BC)

  • MIMO/handset multi-antenna isolation and ECC

  • Mutual coupling analysis

AI-accelerated design

  • Rapid parametric sweeps with AIAntenna surrogate models

  • Reconstruct 3D patterns from 2D slices (patternFromAI)

  • Full-factorial design space exploration

  • Export AI-tuned designs for full-wave validation

Optimization

  • Optimize antenna dimensions for gain, bandwidth, SLL, or F/B ratio

  • Built-in optimize() for catalog antennas with string objectives

  • SADEA/TR-SADEA with custom evaluation functions for pcbStack/customAntenna

  • Geometric constraints (linear and nonlinear)

When NOT to Use

  • Reflector antennas, reflectarrays, installed antennas, or RCS — use matlab-analyze-antenna-structures

  • Impedance matching networks, measuredAntenna, RF propagation, or SAR — use matlab-integrate-antenna

Must-Follow Rules

Catalog Antennas
  • Prefer catalog antennas over customAntenna — use customAntenna only when no catalog antenna or system antenna matches the requested geometry

  • Always use design() unless user provides explicit dimensions or antenna lacks design() support

  • Set substrate BEFORE design() — design() adapts dimensions to the substrate

  • Mesh at lambda/8 for substrate antennas after design() and before analysis

  • Use SweepOption="interp" only with sparameters (not impedance) on substrate antennas

Custom Antennas (customAntenna)
  • Use shape.* namespace (NOT antenna.*) with customAntenna

  • All dimensions in meters — not mm or cm

  • Always define a feed — customAntenna without createFeed cannot be analyzed

  • Feed must be at a geometric discontinuity — not middle of flat plate

  • Extrude first, rotate second — extrudeLinear requires XY-plane shapes

  • Shapes are handle objects — use copy() to preserve before transforming

PCB Antennas (pcbStack)
  • Set BoardThickness BEFORE Layers — otherwise dielectric gets wrong thickness

  • Use antenna.* namespace (NOT shape.*) for pcbStack metal patterns

  • Layer indices are cell array positions — in {M,D,M}, ground is index 3

  • design() does not work on pcbStack — design catalog antenna first, then convert

  • Gerber Filename must be char ('single quotes'), not "string"

Arrays
  • Always pass element as 3rd argument to design(arr, freq, element) — omitting resets to dipole

  • AmplitudeTaper for rectangularArray is column-major order

  • Infinite arrays have no NumElements/ElementSpacing — unit cell = ground plane size

  • Use phaseShift() for finite steering, ScanAzimuth/ScanElevation for infinite

AI Workflows
  • Use design(..., ForAI=true) — direct em.ai.AIAntenna() constructor not supported

  • Only 12 antenna types have pretrained AI models

  • Input slices for patternFromAI must be row vectors with 1-degree integer spacing

  • Always validate AI predictions with exportAntenna + full-wave simulation

Optimization
  • Start from design() to get physically reasonable initial dimensions

  • Tier 1 bounds: cell array {lb1,lb2; ub1,ub2}, Tier 2 bounds: numeric matrix [lb;ub]

  • Negate metrics for maximization in custom evaluation functions (SADEA minimizes)

  • Wrap custom eval in try/catch — return 1e6 penalty for invalid geometry

  • Set FrequencyRange explicitly for bandwidth optimization (default +/-5% may not match target)

Workflow

1. Catalog Antenna Design
  1. Parse — Identify antenna type, frequency, substrate, constraints

  2. Create — Set substrate (if any), call design(ant, freq)

  3. Mesh — mesh(ant, MaxEdgeLength=lambda/8) for substrate antennas

  4. Analyze — Impedance, S-parameters, 3D pattern, 2D cuts with polarpattern

  5. Report — Key metrics with units (Z, BW, gain, beamwidth)

2. Custom Antenna Design
  1. Build shapes — shape.* primitives (Rectangle, Box, Cylinder, Polygon)

  2. Transform — translate, rotate, scale (handle objects — copy first)

  3. Combine — Boolean: + (union), - (subtract), & (intersect)

  4. Extrude — extrudeLinear (taper) or extrudeRotate (revolution)

  5. Assemble — customAntenna(Shape=...), createFeed(ant, loc, numEdges)

  6. Mesh & analyze — mesh(ant, MaxEdgeLength=lambda/6), impedance, pattern

3. PCB Antenna Design
  1. Define stackup — pcbStack, set BoardThickness FIRST, then Layers

  2. Create patterns — antenna.* shapes with boolean operations

  3. Configure feed — FeedLocations = [x, y, sigLayer, gndLayer]

  4. Analyze — S-parameters (with SweepOption="interp"), pattern

  5. Export — gerberWrite with PCBWriter, PCBServices, PCBConnectors

4. Array Design
  1. Build array — Set type, size/elements, then design(arr, freq, element)

  2. Steer — phaseShift() finite, ScanAzimuth/ScanElevation infinite

  3. Taper — AmplitudeTaper (column-major for rectangular)

  4. Analyze — arrayFactor (fast) → patternMultiply → pattern (accurate)

  5. Coupling — sparameters, correlation, isolation metrics

5. AI-Accelerated Design
  1. Create — design(ant, freq, ForAI=true) for supported types

  2. Explore — tunableRanges, parametric sweep, resonantFrequency, bandwidth

  3. Validate — exportAntenna + full-wave impedance/pattern

  4. Reconstruct — patternFromAI from 2D slices (row vectors, 1-deg spacing)

6. Optimization
  1. Formulate — Choose objective, design variables, bounds, constraints

  2. Select tier — Catalog + built-in objective → Tier 1; else → Tier 2

  3. Run — optimize() or OptimizerSADEA/OptimizerTRSADEA

  4. Extract — getBestMemberData, showConvergenceTrend, isConverged

  5. Validate — Full analysis sweep on optimized design

Key Classes

ClassPurpose
design()Scale catalog antennas to frequency
customAntennaArbitrary geometry from shape.* primitives
pcbStackMulti-layer PCB antenna with antenna.* shapes
linearArray / rectangularArray / circularArrayFinite arrays
conformalArrayArbitrary element positions (MIMO, custom)
infiniteArrayUnit cell with Floquet BC
em.ai.AIAntennaPretrained surrogate for instant prediction
patternFromAI3D pattern from 2D slices
optimize()Built-in SADEA for catalog antennas
OptimizerSADEA / OptimizerTRSADEACustom optimization

Conventions

Coding Standards
  • 4-space indentation, lowerCamelCase variables, UpperCamelCase Name-Value args

  • "double quotes" for strings (except Gerber Filename which requires 'char')

  • fprintf for formatted output

  • Do not add titles to Antenna Toolbox plots (pattern, show, rfplot, impedance)

  • Do add titles to manual plot figures and TitleTop to polarpattern

  • Show all plots in separate figures. Include units in all output.

  • Use physconst("LightSpeed") — never hardcode 3e8

Script-First Workflow

For design, analysis, or sweep tasks — write code to .m files, run via run_matlab_file, iterate by editing and re-running. Use inline evaluate_matlab_code for quick one-off checks.

References
Load when...Reference
Designing catalog antennas (types, design(), substrate, patterns)references/catalog-antennas.md
Building custom antennas (shape.*, extrusion, feeds, substrate)references/custom-antennas.md
Designing PCB antennas (pcbStack, layers, boolean, Gerber)references/pcb-antennas.md
Designing arrays (finite, infinite, steering, taper, MIMO)references/arrays.md
AI design exploration (AIAntenna, patternFromAI, surrogates)references/ai-antenna-workflows.md
Optimizing antennas (SADEA, bounds, constraints, custom eval)references/optimization.md

Copyright 2026 The MathWorks, Inc.

Files

references/optimization.md

Antenna and Array Optimization

Tier Selection

ConditionTier
Catalog antenna + built-in objective stringTier 1: optimize()
customAntenna/pcbStack or custom objectiveTier 2: OptimizerSADEA/OptimizerTRSADEA

Tier 1: Built-in optimize()

Syntax
[optAnt, optinfo] = optimize(element, freq, objective, propertynames, bounds, Name=Value)
Built-in Objectives
Objective StringGoal
"maximizeGain"Maximize peak gain
"maximizeBandwidth"Maximize impedance bandwidth
"minimizeBandwidth"Minimize bandwidth (narrowband)
"maximizeSLL"Maximize front-lobe to sidelobe ratio
"frontToBackRatio"Maximize front-to-back ratio
"minimizeArea"Minimize antenna footprint
String Constraints
Constraints={'S11 < -10', 'Gain > 5', 'Area < 0.03'}
ConstraintUnitsDescription
'S11 < value'dBMaximum return loss
'Gain > value'dBiMinimum gain
'F/B > value'dBMinimum front-to-back
'SLL > value'dBMinimum sidelobe level
'Area < value'm^2Maximum area
'Volume < value'm^3Maximum volume
Name-Value Arguments
NameDefaultDescription
ConstraintsnoneCell array of strings
WeightsequalPenalty weights (1-100)
FrequencyRange+/-5%Frequency vector for BW analysis
ReferenceImpedance50Reference Z (ohms)
MainLobeDirection[0, 90][az, el] for gain eval
Iterations200Optimization iterations
UseParallelfalseParallel evaluation
EnableCouplingtrueMutual coupling in arrays
GeometricConstraintsnoneFrom initGeomConstraint
UseAlgorithm"SADEA""SADEA" or "TR-SADEA"

FrequencyRange trap: Default is +/-5%. For bandwidth optimization, always set explicitly.

Bounds Format

Two-row cell array: {lower1, lower2; upper1, upper2}:

ant = design(patchMicrostrip, 2.4e9);
[optAnt, optinfo] = optimize(ant, 2.4e9, "maximizeGain", ...
    {'Length', 'Width'}, {0.6*ant.Length, 0.6*ant.Width; 1.4*ant.Length, 1.4*ant.Width}, ...
    Constraints={'S11 < -10'}, Iterations=50);

Vector-valued properties (like FeedOffset = [x, y]):

optimize(ant, freq, "maximizeGain", ...
    {'Length', 'Width', 'FeedOffset'}, ...
    {lbL, lbW, [0, 0]; ubL, ubW, [0.01, 0.005]}, Iterations=50);
Common Design Variables
AntennaVariables
patchMicrostripLength, Width, Height, FeedOffset
dipoleLength, Width
yagiUdaReflectorLength, DirectorLength, ReflectorSpacing, DirectorSpacing
hornFlareLength, FlareWidth, FlareHeight
linearArrayElementSpacing

Keep to 2-6 design variables for catalog antennas.

System antennas (reflector, cavity, etc.): Properties like Length and Width belong to Exciter or Element, not the top-level object. Use dot notation:

% Wrong: {'Length', 'Width', 'Spacing'}  — errors on reflector
% Right:
designVars = {'Exciter.Length', 'Exciter.Width', 'Spacing'};

If a property isn't found on the top-level object, check properties(ant.Exciter) or properties(ant.Element).

Geometric Constraints

Enforce relationships between design variables via Ax <= b.

Translation Recipe
  1. Write constraint in English: "Length must be at most 5× Width"

  2. Standard form: Length - 5*Width <= 0

  3. Map to A row: [1, -5], b = 0

Example
designVars = {'Length', 'Width', 'Height'};

gc = initGeomConstraint;
gc.A = [1, -3, 0;     % Length <= 3*Width
        0, -1, 1];    % Height <= Width
gc.b = [0; 0];

optimize(ant, freq, "maximizeGain", designVars, bounds, ...
    GeometricConstraints=gc, Iterations=50);
Common Templates
ConstraintA Rowb
Length <= k*Width[1, -k, 0, ...]0
Prop_i - Prop_j >= gap[..., -1, ..., 1, ...]-gap
Sum <= max[..., 1, ..., 1, ...]max
Nonlinear Geometric Constraints

Use a named function (not anonymous):

gc = initGeomConstraint;
gc.nlcon = @areaConstraint;
gc.nrlv = [1, 1];    % relevance: matches total design variable count

function [c, ceq] = areaConstraint(x)
    c = x(1)*x(2) - 0.04;    % c <= 0
    ceq = 0;                  % must return nonempty
end

Three gotchas:

  1. Must use named function handle (not anonymous)

  2. Must set gc.nrlv (vector of 1s/0s for participating variables)

  3. ceq must be nonempty (return 0, not [])

Tier 2: OptimizerSADEA / OptimizerTRSADEA

Custom Evaluation Function Pattern

The function takes a vector and returns a scalar fitness. SADEA minimizes.

% TEMPLATE — not executable (createMyAntenna must be defined for your design)
function fitness = evaluateAntenna(x)
    freq = 2.4e9;
    try
        ant = createMyAntenna(x);
    catch
        fitness = 1e6;    % penalty for invalid geometry
        return;
    end

    try
        gain = pattern(ant, freq, 0, 90, Type="realizedgain");
        objective = -gain;    % negate to maximize
    catch
        objective = 1e6;
        return;
    end

    s = sparameters(ant, linspace(freq*0.9, freq*1.1, 11));
    s11_max = max(20*log10(abs(rfparam(s, 1, 1))));
    constraint = max(s11_max - (-10), 0);

    fitness = objective + 100 * constraint;
end

Key rules:

  • Wrap in try/catch, return 1e6 for invalid geometries

  • Negate metrics for maximization

  • Mesh customAntenna explicitly: mesh(ant, MaxEdgeLength=lambda/8)

  • Save as separate .m file (not inline)

Before writing the eval function, identify the analysis function for your objective and verify its required inputs:

FunctionRequired InputsCommon Mistake
bandwidth(ant, freqVector)Frequency vector (not scalar)Passing single freq
pattern(ant, freq, az, el)Frequency + anglesOmitting angle args
beamwidth(ant, freq, az, el)Frequency + angle cutWrong cut plane
impedance(ant, freqVector)Frequency vectorPassing single freq
sparameters(ant, freqVector)Frequency vectorPassing single freq

Test the analysis call standalone before wrapping in try/catch — the penalty value masks silent failures.

Geometric Constraints in Tier 2

Prefer GeometricConstraints over penalty terms — the optimizer handles them natively with better convergence. Do not embed constraint penalties inside the eval function.

bounds = [lb1, lb2, lb3; ub1, ub2, ub3];
s = OptimizerSADEA(bounds);
s.CustomEvaluationFunction = @evaluateAntenna;

% Add geometric constraints (same API as Tier 1)
gc = initGeomConstraint;
gc.A = [1, -2, 0];   % Length <= 2*Width (L - 2W <= 0)
gc.b = 0;
s.GeometricConstraints = gc;
Running the Optimizer
bounds = [lb1, lb2, lb3; ub1, ub2, ub3];  % numeric matrix
s = OptimizerSADEA(bounds);
s.CustomEvaluationFunction = @evaluateAntenna;
setMaxFunctionEvaluations(s, 200);
defineInitialPopulation(s, 10);
s.optimizeWithPlots(50);
bestData = s.getBestMemberData;
TR-SADEA for High-Dimensional Problems

For 30+ design variables. Requires Statistics and Machine Learning Toolbox.

s = OptimizerTRSADEA(bounds);
s.CustomEvaluationFunction = @evaluateAntenna;
s.optimizeWithPlots(100);

Result Extraction

Built-in optimize()
[optAnt, optinfo] = optimize(ant, freq, "maximizeGain", vars, bounds, Iterations=50);
bestData = optinfo.getBestMemberData;
fprintf("Best fitness: %.4f\n", bestData.fitness);
fprintf("Converged: %d\n", optinfo.isConverged);
figure; optinfo.showConvergenceTrend;
Optimizer Objects
bestData = s.getBestMemberData;
optimizedVars = bestData.member;
bestFitness = bestData.fitness;
fprintf("Converged: %d\n", s.isConverged);
figure; s.showConvergenceTrend;

Post-Optimization Validation

Always verify independently:

figure; show(optAnt);
figure; impedance(optAnt, freqRange);
sParams = sparameters(optAnt, freqRange);
figure; rfplot(sParams);
figure; pattern(optAnt, freq);

Iteration Guidelines

Design VariablesIterationsExpected Evaluations
2-330-5040-80
4-650-10070-140
7-15100-200130-260
16-30200+ (TR-SADEA)250+

How SADEA Works

SADEA builds a surrogate model from a small number of EM simulations, then searches efficiently. Initial phase runs ~m*N evaluations (N = design variables) to build the model. TR-SADEA adds local search for high-dimensional problems.

Fitness sign: For maximization, SADEA negates internally. Fitness plot trends downward as objective improves.


Copyright 2026 The MathWorks, Inc.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
MathWorks
Publisher
MathWorks (Official)
Source
matlab/matlab-agentic-toolkit · skills-catalog/rf-and-mixed-signal/matlab-design-antenna · commit 2a7f215
Licence
BSD 2-Clause License (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE.md)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by MathWorks.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download matlab-design-antenna.zip