PCB Antenna Feed-point creation
이전 댓글 표시
I am trying to simulate a PCB antenna, with individual layers and via drill size/locations imported from a Gerber file/layers output. I can import this with the "pcbStack" command. However, I loose the original orientation and x-y coordinates. And I cannot create a feed point, properly, for the antenna. How do I do that?
답변 (1개)
Umar
2026년 8월 17일 21:20
0 개 추천
Hi @Scott,
Two things going on here, both expected behavior on MathWorks' side (not a bug):
Feed points: Gerber files don't carry any feed information at all — MathWorks says this outright in their Gerber-import example. So pcbStack always drops the default feed at (0,0), no matter what your actual board geometry looks like. You have to set it yourself after import:
pb = pcbStack(P1);
pb.FeedDiameter = .001;
pb.FeedLocations(1:2) = [0, 0.035]; % your real feed x,y
Coordinates/orientation: the imported polygon keeps whatever raw origin was baked into the Gerber file itself, which is often not centered or aligned the way you'd expect. Before building the pcbStack, pull the polygon and re-anchor it to something you understand:
p1 = PCBReader(StackUp=S);
s = p1.shapes;
[x,y] = centroid(s);
translate(s,[-x, -y, 0]); % or use boundingbox() for an asymmetric board
Once it's in a frame you understand, build the pcbStack from that shape and set FeedLocations relative to that same origin — that combo is likely what's been tripping you up.
One other thing worth double-checking: gerberRead only supports up to two metal layers and doesn't support cut-ins. If your board has more layers than that, that alone could explain missing geometry after import.
No automatic rotation happens on import as far as I can tell — if orientation looks off, it's most likely the same root-cause as #2: the raw Gerber coordinates don't match your mental picture of the layout, not the toolbox flipping anything. MathWorks has worked examples for all of this — search "Create Antenna Model from Gerber Files" and "Translate Center of Imported Symmetrical/Asymmetrical Polygon" in the Antenna Toolbox docs.
Hope this helps!
댓글 수: 4
Scott
2026년 8월 24일 23:10
Umar
2026년 8월 25일 0:58
Hi @Scott,
Before I try to pin this down further, can you give me a bit more info? What MATLAB release are you running (just type ver and paste what comes back)? And which of the three custom antenna types is actually giving you grief — customAntenna, customAntennaMesh, or customAntennaStl?
The reason I ask is those three don't all use createFeed the same way — two of them want a location plus a number of edges, but customAntennaMesh wants two separate points instead. If you're using the same command style on all of them, that alone could be why it's failing on more than one.
It'd also help to know exactly what happens when you try — do you get an error message, or does it just quietly not create a feed? If there's an error, paste the exact text.
One thing worth trying in the meantime: instead of typing in coordinates by hand, call createFeed(c) with nothing else and it'll pop open a window where you click directly on the mesh to pick the feed edge. A lot of the "I can't get a feed point no matter what I do" issues come down to typed coordinates not lining up exactly with an edge in the mesh, and clicking it directly avoids that problem entirely.
Once I know your version and which class you're stuck on, I can give you something more exact instead of guessing.
Scott
2026년 8월 25일 15:32
Umar
2026년 8월 27일 3:34
Hi @Scott,
Good news — both of your earlier issues are now explained:
createFeed error: That function only works on customAntenna/customAntennaMesh/customAntennaStl — it doesn't exist for pcbStack, so the error was expected. Just drop that line. Your FeedDiameter/FeedLocations code was already the correct way to set a feed on a pcbStack.
The (1:2) syntax: Just normal MATLAB indexing — it overwrites the x,y part of FeedLocations and leaves the layer numbers alone. Your full version ([45*mm -59.5*mm 2 4]) is correct and complete; no need to worry about it.
The real remaining problem is the mesh error, and it's about BoardShape, not your feed placement. Try:
NBMPA1.BoardShape figure show(NBMPA1.BoardShape)
and compare that against your actual board size and your feed/via pad locations. gerberRead doesn't take an outline file, so BoardShape isn't coming from anything you explicitly gave it — I don't have a solid doc reference for exactly how it's derived here, so it's worth just checking directly rather than guessing.
Two likely culprits:
The board shape it inferred is too small — the mesher checks the full pad footprint (center ± radius), so a feed/via can look "inside" in a 3D view but still poke outside the boundary.
If you re-centered the top layer but not the bottom layer by the same amount, the two layers (and the board shape) could be misaligned relative to each other.
If BoardShape looks wrong, just set it explicitly to your real board dimensions:
NBMPA1.BoardShape = antenna.Rectangle(Length=..., Width=..., Center=[...]);
Let me know what show(NBMPA1.BoardShape) looks like next to your actual board — that'll tell us if it's a size issue or an alignment issue.
카테고리
도움말 센터 및 File Exchange에서 Full-Wave Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!