Matlab Optimize Pcb DesignSAFE
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
Overview
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
58967e6f32b5OBSERVED · 2026-10-14What it tells the agent
The instruction file, verbatim from the audited commit — this is the text the model reads, and the surface the audit's instruction layer examines. Quoted here so you can judge it without cloning anything.
---
name: matlab-optimize-pcb-design
description: "Optimize RF PCB dimensions for bandwidth, return loss, or area via patternsearch and surrogateopt with constraints. TRIGGER: user asks to optimize an RF PCB component for performance (bandwidth, return loss, insertion loss, area) or apply constraints to a design. Invoke BEFORE writing optimization code — RF PCB Toolbox has a built-in optimize() function that differs from generic fmincon/ga approaches. SKIP: designing a component from scratch without an optimization objective (use the specific matlab-design-pcb-* skill), EM analysis without optimization (use matlab-analyze-em), material/stackup setup only (use matlab-manage-pcb-material)."
license: https://www.mathworks.com/content/dam/mathworks/license/pmrl/license.md
metadata:
author: MathWorks
version: "1.0"
---
# Optimizing RF PCB Designs
## Critical: Always Use optimize() First
**The RF PCB Toolbox provides a built-in `optimize()` function that handles all standard optimization scenarios.** Always use it as the first approach — do NOT write manual optimization loops with `patternsearch`, `surrogateopt`, `fmincon`, or `ga` called directly unless `optimize()` is demonstrably insufficient for the specific problem.
## When to Use
- Tuning filter, coupler, or splitter dimensions for return loss, bandwidth, or area
- Running `optimize()` on catalog objects with bounds and constraints
- Using SADEA/TR-SADEA, patternsearch, or surrogateopt via the `optimize()` interface
- Defining custom objective functions over S-parameter responses
## When NOT to Use
- Designing components from scratch — use `matlab-design-pcb-filter`, `matlab-design-pcb-coupler`, etc. first, then optimize
- Running EM analysis without optimization — use `matlab-analyze-em`
- Parameter sweeps without an objective — just loop over `sparameters` calls directly
- Antenna-only optimization without PCB context — use Antenna Toolbox docs
## Typical Workflow
1. **Before:** A design skill (`matlab-design-pcb-filter`, `matlab-design-pcb-transmission-line`, etc.) — create the initial component; `matlab-analyze-em` — baseline S-parameters
2. **This skill:** Define objective, bounds, constraints; run `optimize()`
3. **After:** `matlab-analyze-em` — validate optimized design → `matlab-integrate-pcb-circuit` — cascade into system → `matlab-write-pcb-layout` — export Gerber
## Quick Reference
| Task | Code |
|------|------|
| Design at frequency | `obj = design(ObjectType, fc)` |
| Optimize | `optObj = optimize(obj, freq, objective, props, bounds, solver)` |
| With constraints | `optimize(..., 'Constraints', constraints)` |
| With options | `optimize(..., 'OptimizerOptions', opts)` |
## Algorithm Overview
| Algorithm | Source | Best For | Typical Time |
|---|---|---|---|
| `sadea` | Antenna Toolbox (SADEA) | Default global search, few EM evaluations | 5--30 min |
| `trsadea` | Antenna Toolbox (TR-SADEA) | Trust-region variant, better local refinement | 5--30 min |
| `patternsearch` | Global Optimization Toolbox | Derivative-free, smooth/noisy EM objectives, fine-tuning | 2--15 min |
| `surrogateopt` | Global Optimization Toolbox | Expensive black-box functions, many variables, global optimum | 10--60 min |
- **Start with SADEA** -- it requires no additional toolbox beyond Antenna Toolbox and handles most RF/PCB optimization problems well.
- **Use `patternsearch` for fine-tuning** -- after SADEA finds a good region, refine with patternsearch starting from the SADEA result.
- **`surrogateopt` for expensive models** -- builds a surrogate model and is more sample-efficient when each EM solve is costly.
## Timing and Practical Considerations
- **MoM simulation per evaluation**: 2--30 seconds for simple components, minutes for high-order filters
- **Behavioral mode**: Use `pcbElement(comp, Behavioral=true)` for fast analytical evaluations during optimization sweeps
- **Iteration budget**: Set `MaxIterations` to 20--50 when running interactively to stay responsive; use 100--200 for batch runs
- **Parallel computing**: Set `UseParallel=true` if Parallel Computing Toolbox is available for significant speedup with patternsearch and surrogateopt
## design() — Initial Sizing
The `design` function sizes any catalog component for a target frequency:
```matlab
ws = design(wilkinsonSplitter, 3e9);
bl = design(couplerBranchline, 5e9);
fh = design(filterHairpin, 2.4e9);
ms = design(microstripLine, 3e9);
```
This produces a starting point for subsequent optimization. All geometric parameters are auto-computed for the target frequency.
## optimize() Syntax
```matlab
optObj = optimize(obj, freq, objective, properties, bounds, solver, ...
'Constraints', constraints, 'OptimizerOptions', opts)
```
| Argument | Type | Description |
|----------|------|-------------|
| `obj` | Object | Catalog object (initial design) |
| `freq` | Scalar or vector | Single frequency or frequency vector for optimization |
| `objective` | String | Built-in or custom objective function name |
| `properties` | Cell array | Property names to vary |
| `bounds` | 2-element cell | `{[lower1 lower2 ...]; [upper1 upper2 ...]}` |
| `solver` | String | `'patternsearch'`, `'surrogateopt'`, `'sadea'`, or `'trsadea'` |
| `constraints` | Struct | S-parameter constraints (optional NV pair) |
| `opts` | optimoptions | Optimizer options object created with `optimoptions()` |
## Built-in Objectives
| Objective String | Minimizes/Maximizes |
|-----------------|---------------------|
| `"minimizeArea"` | Minimizes board area |
| `"maximizeBandwidth"` | Maximizes -10 dB return loss bandwidth |
| `"maximizeReturnLoss"` | Maximizes worst-case return loss |
| `"minimizeBandwidth"` | Narrows the passband |
## Example: Minimize Area with Constraints
```matlab
obj = design(wilkinsonSplitter, 3e9);
props = {'SplitLineLength', 'SplitLineWidth', 'Resistance', ...
'PortLineLength', 'GroundPlaneWidth'};
bounds = {[10e-3 1e-3 50 2e-3 10e-3]; % Lower bounds
Trust audit
SAFEgrade B · trust 89/100 Nothing in the source contradicts what it says it does. Grade A is reserved for packages that have also passed the behavioural sandbox.
| Layer | What it checks | Result |
|---|---|---|
| L0 | Provenance & inventory | PASS |
| L1 | Static analysis of the code | NA |
| L2 | Instruction surface (what it tells the agent) | PASS |
| L3 | Class-specific surface | PASS |
| L4 | Behavioural (sandbox) | SKIPPED |
What the source does
- Filesystem
- none-observed
- Network
- none-observed
- Shell
- none-observed
- Dependencies
- pinned
- Secrets in source
- none-found
Findings (0)
No findings outside the package's declared scope.
Gates applied: no_behavioural_pass.
58967e6f32b5full audit observations/trust-audit/skill/matlab__matlab-optimize-pcb-design.json · Report an issue / request a re-scanAudit history
Every audit this skill has had.
| Date | Source | Verdict | Grade | Score | Change |
|---|---|---|---|---|---|
| 2026-10-14 | 58967e6f32b5 | SAFE | B | 89 | first audit |
Questions
What does the Matlab Optimize Pcb Design skill do?
The MATLAB Agentic Toolkit brings proven MATLAB capabilities to AI agents, making engineering and scientific workflows agent-ready.
Is Matlab Optimize Pcb Design safe to install?
The audit found nothing in the source that contradicts what it says it does, and graded it B (89/100). Grade A is held back for packages that have also passed a sandboxed behavioural run, which is why a clean skill reads B.
What can Matlab Optimize Pcb Design access on my machine?
The audit observed no filesystem, network or shell use at all in its source.
How current is this page?
The grade is for one exact copy of the source (58967e6f32b5), read on 2026-10-14. The repository is watched, and a new audit runs when it changes — this is the first audit.