mcpField
M
matlab-design-pcb-passive

matlab-design-pcb-passive

github.com/matlab其他1.2k74 次安装1 天前更新
代码仓库

关于 matlab-design-pcb-passive

该技能指导使用 MATLAB 设计和分析 RF 无源组件,涵盖电感、电容、谐振器、巴伦、移相器和径向短截线。面向 PCB 与 RF 电路设计者,并提供参数配置、模型分析及优化流程。

主要功能

  1. 01设计螺旋电感与交指电容
  2. 02创建环形及裂环谐振器
  3. 03配置耦合线与 Marchand 巴伦
  4. 04设计 Schiffman 移相器和径向短截线
  5. 05提取电感、电容与 S 参数
  6. 06优化组件尺寸并集成电路

适用场景

  1. 01为 RF 电路设计无源组件
  2. 02提取组件的频率相关电气参数
  3. 03用行为模型初步评估 S 参数
  4. 04优化尺寸并组合电路组件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-design-pcb-passive

安装后在 Claude Code 中输入/matlab-design-pcb-passive确认已加载。

附带文件manifest.yamlreferences/resonators-detail.md

详细介绍

设计无源元件

适用场景

  • 为 RF 电路设计螺旋电感或交指电容
  • 从无源元件中提取电感、电容或自谐振频率
  • 为滤波或超材料应用创建环形或开口环谐振器
  • 设计耦合线或 Marchand 巴伦,以实现平衡与非平衡转换
  • 构建 Schiffman 移相器或径向短截线

不适用场景

  • 设计传输线(微带线、带状线、CPW)——使用 matlab-design-pcb-transmission-line
  • 设计滤波器(带通、低通、带阻)——使用 matlab-design-pcb-filter
  • 设计耦合器或分路器——使用 matlab-design-pcb-coupler
  • 设置基板材料——使用 matlab-manage-pcb-material
  • 设计后进行 EM 分析——使用 matlab-analyze-em

典型工作流

  1. 之前: matlab-manage-pcb-material — 设置基板和导体
  2. 此技能: 设计无源元件(电感、电容、巴伦、谐振器)
  3. 检查网格/内存: memoryEstimate(obj, fc, 'RetainMesh', true) — 在开始完整求解前检查自动网格密度
  4. 之后: matlab-analyze-em — 验证 S 参数 → matlab-optimize-pcb-design — 调整尺寸 → matlab-integrate-pcb-circuit — 级联到电路中

快速参考

任务代码
螺旋电感ind = spiralInductor
交指电容cap = interdigitalCapacitor
提取电感L = inductance(ind, freq)
提取电容C = capacitance(cap, freq, DeEmbed=true)
行为模型 S 参数S = sparameters(obj, freq, Behavioral=true)
环形谐振器r = design(resonatorRing, freq)
开口环(自定义)r = resonatorSplitRingCustom
开口环(方形)r = resonatorSplitRingSquare
耦合线巴伦b = balunCoupledLine
Marchand 巴伦b = balunMarchand
移相器ps = design(phaseShifter, freq, PhaseShift=90)
径向短截线stub = stubRadialShunt
优化optimize(obj, freq, ...)

螺旋电感

创建和配置
ind = spiralInductor;
ind.SpiralShape    = 'Square';      % 'Square' | 'Circle' | 'Hexagon' | 'Octagon'
ind.InnerDiameter  = 5e-4;
ind.Width          = 2.5e-4;
ind.Spacing        = 2.5e-4;
ind.NumTurns       = 4;
ind.Height         = 1.016e-3;      % Must be a cumulative substrate layer boundary
ind.GroundPlaneLength = 5.6e-3;
ind.GroundPlaneWidth  = 5.6e-3;
RFIC 基板(硅/SiO2)
ind = spiralInductor;
ind.Substrate = dielectric('Name', {'Silicon','SiO2'}, ...
    'EpsilonR', [11.9, 4.1], 'LossTangent', [0.005, 0], ...
    'Thickness', [300e-6, 3e-6]);
ind.Height = 303e-6;              % Signal trace at top of stack
螺旋形状与 Q 值权衡
形状Q 值说明
'Circle'最高电气性能最佳
'Octagon'高接近圆形;更易制造
'Hexagon'中等折中方案
'Square'最低最易制造;转角处会产生电流拥挤
地平面邻近效应

较小的 Height 会增强与地的电容耦合,从而降低电感、Q 值和自谐振频率。PCB 层叠结构限制 Height 时,请将此因素纳入考虑。

电感提取
L = inductance(ind, 600e6);                        % Scalar frequency → scalar (H)
L = inductance(ind, linspace(100e6, 1e9, 30));     % Vector → vector
自谐振频率(SRF)

在 SRF 处,寄生电容与电感发生谐振——阻抗达到峰值,随后电感表现为电容。设计时应确保工作频带低于 SRF/3 至 SRF/2。

freq = linspace(100e6, 10e9, 201);
L = inductance(ind, freq);
% Sign change: L > 0 (inductive) → L < 0 (capacitive) at SRF
可视化
show(ind)
current(ind, 600e6)
charge(ind, 600e6)
[E, H] = EHfields(ind, 4e9, [0; 0; 1]);

交指电容

创建和配置
cap = interdigitalCapacitor;
cap.NumFingers         = 4;
cap.FingerLength       = 0.0137;
cap.FingerWidth        = 3.16e-4;
cap.FingerSpacing      = 3e-4;
cap.FingerEdgeGap      = 3.41e-4;
cap.TerminalStripWidth = 5e-4;
cap.PortLineWidth      = 1.9e-3;
cap.PortLineLength     = 3e-3;
cap.Height             = 7.87e-4;
电容提取
C = capacitance(cap, 5e9);                                          % Raw
C = capacitance(cap, 5e9, DeEmbed=true);                            % De-embedded
C = capacitance(cap, 5e9, DeEmbed=true, IncludeParasitics=true);    % With parasitics
  • DeEmbed 会移除馈线的影响,以便单独提取电容。
  • IncludeParasitics 会加入指状结构产生的寄生电感/电阻。

行为模型 S 参数

spiralInductor 和 interdigitalCapacitor 均支持快速行为模型:

S = sparameters(ind, freq, Behavioral=true);     % ~instant
S = sparameters(cap, freq, Behavioral=true);

初步探索时可使用该模型;验证时应切换到全波模式(Behavioral=false,默认值)。进行全波求解前,务必检查网格密度:

memoryEstimate(ind, fc, 'RetainMesh', true);  % Check auto-mesh before full-wave
sp = sparameters(ind, freq, 'SweepOption', 'interp');

环形谐振器

resonatorRing 是一种微带环形谐振器,通过间隙与两条馈线耦合。

r = resonatorRing;
r.RingRadiusOuter = 0.01;
r.RingWidth       = 4e-3;
r.CouplingGap     = 1e-3;
r.PortLineLength  = 0.01;
r.PortLineWidth   = 5e-3;
r.Height          = 1.6e-3;
r.GroundPlaneWidth = 0.04;
基于频率的设计
r = design(resonatorRing, 1.8e9);                  % 50 Ω default
r = design(resonatorRing, 2.5e9, Z0=75);            % 75 Ω

开口环谐振器

有两种对象类型:resonatorSplitRingCustom(可插拔形状)和 resonatorSplitRingSquare(预配置的方形)。

自定义开口环谐振器
r = resonatorSplitRingCustom;
sr = splitRing(Type="Hexagon", NumRings=3);
sr.SplitSide = [2 3 5];
r.Resonator = sr;
r.FeedType  = 'Tapped';         % 'Tapped' (default) or 'Coupled'
r.PortLineLength = 0.01;
r.PortLineWidth  = 7.5e-4;
r.Height = 8.13e-4;
方形开口环谐振器
r = resonatorSplitRingSquare;
r.RingLengthInner   = 3.6e-3;
r.RingWidth          = 5e-4;
r.RingSpacing        = 3e-4;
r.SplitGap           = 5e-4;
r.CouplingGap        = 2.5e-4;
r.NumResonator       = 5;
r.ResonatorSpacing   = 4e-3;

完整的 splitRing 形状属性表、CSRR 接地平面蚀刻和 SIW 集成模式,请参阅 references/resonators-detail.md。

耦合线巴伦

balunCoupledLine 是一种 3 段耦合线巴伦(平衡-不平衡转换器)。

b = balunCoupledLine;
b.NumCoupledLineSection = 3;
b.CoupledLineLength     = 0.0153;
b.CoupledLineWidth      = 4e-4;
b.CoupledLineSpacing    = 1.4e-4;
b.OutputLineLength      = 0.0124;
b.OutputLineWidth       = 1.53e-4;
b.OutputLineSpacing     = 0.011;
b.Height                = 1.3e-3;

balunCoupledLine 没有 design() 方法。根据阻抗目标逐段确定尺寸,请使用 designCoupledLine、designOutputLine、designUncoupledLine。完整 API 请参阅 references/resonators-detail.md。

Marchand 巴伦

balunMarchand 是一种使用 λ/4 耦合线段的宽带巴伦。

bm = balunMarchand;
bm.CoupledLineLength  = 0.0178;
bm.CoupledLineWidth   = 3e-3;
bm.CoupledLineSpacing = 1.5e-4;
bm.OutputLineLength   = 0.016;
bm.OutputLineWidth    = 2.9e-4;
bm.Height             = 1.6e-3;

没有 design() 方法。手动设置尺寸或使用 optimize()。

移相器

phaseShifter 是一种使用耦合线段的 Schiffman 型移相器。

ps = design(phaseShifter, 1.8e9);                    % Default phase shift
ps = design(phaseShifter, 1.8e9, PhaseShift=90);      % 90° phase shift
属性
ps.NumSections  = 1;
ps.PortLineLength = 0.01;
ps.PortLineWidth  = 5e-3;
ps.Height         = 1.6e-3;
ps.SectionShape   = ubendRightAngle;     % Default U-bend shape

径向枝节

stubRadialShunt 可创建单径向或双径向并联枝节。与矩形枝节相比,径向枝节可提供宽带短路特性。

stub = stubRadialShunt;
stub.StubType       = "Single";     % "Single" (default) or "Double"
stub.OuterRadius    = 8.5e-3;
stub.InnerRadius    = 1.2e-3;
stub.Angle          = 90;           % Range [5, 175] degrees
stub.PortLineWidth  = 2.5e-3;
stub.PortLineLength = 0.0137;
stub.Height         = 1.6e-3;

有关双枝节矢量属性配置,请参阅 references/resonators-detail.md。

电路集成

将无源组件封装在 pcbElement 中,以便组装 RF Toolbox 电路:

ckt = circuit;
c1 = interdigitalCapacitor;
c2 = interdigitalCapacitor(NumFingers=3);
p = pcbElement(c2, 'Behavioral', false);
add(ckt, [1 2 0 0], c1);
add(ckt, [2 3 0 0], p);
setports(ckt, [1 0], [3 0]);
S = sparameters(ckt, 8e9);

优化

此技能中的所有对象均支持 optimize():

ind = spiralInductor(NumTurns=3);
optimize(ind, linspace(1e9, 3e9, 11), ...
    'Properties', {'Width', 'Spacing', 'InnerDiameter'}, ...
    'LowerBound', [1e-4, 1e-4, 3e-4], ...
    'UpperBound', [5e-4, 5e-4, 1e-3], ...
    'Objective', 'maximizeBandwidth');

多层介质模式

所有对象都遵循相同模式——在赋值给组件之前设置 Thickness:

sub = dielectric('FR4', 'Teflon');
sub.Thickness = [1.6e-3, 0.8e-3];
obj.Substrate = sub;
obj.Height = 0.8e-3;    % Must match a cumulative layer boundary

注意事项

  1. 对 S 参数使用插值扫描:对于 MoM 求解,始终使用 sparameters(obj, freq, 'SweepOption', 'interp')。直接扫描会逐个频点求解,速度要慢得多。

  2. 求解前检查网格密度:螺旋电感器和交指电容器会生成密集的自动网格。调用 sparameters() 前,始终先运行 memoryEstimate(obj, fc, 'RetainMesh', true)。如果内存占用过高,请粗化网格:mesh(obj, 'MaxEdgeLength', lambda/6)。完整网格检查工作流请参阅 matlab-analyze-em。

  3. 电感器/电容器没有 design() 方法。 spiralInductor 和 interdigitalCapacitor 没有 design() 方法。手动设置尺寸或使用 optimize()。

  4. 电感/电容随频率变化。 两者都需要频率参数——无法提取直流值。寄生效应会使高频下的数值发生偏移。

  5. 电容提取与 DeEmbed 有关。 如果没有设置 DeEmbed=true,提取的电容会包含馈线的影响。

  6. SpiralShape 区分大小写。 请使用 'Square'、'Circle'、'Hexagon'、'Octagon'。

  7. 行为模型与全波精度。 在自谐振频率(电感器)附近或手指谐振(电容器)附近,行为模型的 S 参数会出现偏差。

  8. Height 必须是累积的衬底边界。 对于 Thickness=[t1, t2],有效的 Heights 为 t1、t1+t2。此规则适用于此技能中的所有对象。

  9. spiralInductor 需要多层衬底。 下穿馈线布线需要 ≥ 2 个介质层。单层会报错:"More than one substrate is required."

  10. GroundPlane 尺寸。 接地平面应至少为组件占地的 2×,以避免截断边缘场。

  11. 巴伦没有 design() 方法。 balunCoupledLine 和 balunMarchand 没有 design() 方法。请使用分段设计函数或 optimize()。

  12. 开口环谐振器没有 design() 方法。 只有 resonatorRing 支持 design()。

  13. splitRing 是形状,而非组件。 无法直接分析——请将其附加到 resonatorSplitRingCustom,或嵌入 pcbComponent。

  14. PhaseShift 的单位是度。 design(phaseShifter, ...) 中的 PhaseShift 参数使用度,而不是弧度。

  15. stubRadialShunt 没有 design() 方法。 手动设置尺寸或使用 optimize()。

  16. 多边形的 SplitSide 默认值可能无效。 六边形的 SplitSide 必须为 {2, 3, 5, 6} 中的值。对于具有多个环的多边形类型,务必显式设置。

相关技能

  • matlab-manage-pcb-material — 基板和导体设置
  • matlab-analyze-em — S 参数、场、网格控制
  • matlab-optimize-pcb-design — optimize() 语法、目标、求解器
  • matlab-integrate-pcb-circuit — pcbElement 电路集成
  • matlab-design-pcb-filter — SIW 滤波器可嵌入开口谐振环
  • matlab-assemble-pcb-layout — 通过 pcbComponent + 布尔运算创建自定义 CSRR 结构
  • matlab-design-pcb-coupler — 相关耦合线结构

版权所有 2026 The MathWorks, Inc.

评论

支持 Markdown