Mini Project: A Coaxial Line from Field Solution to Matched Load
Test fixtures, RF filters and high-power feeds often use square coaxial line: a square inner bar centred in a square outer channel, easy to machine from bar stock and plate. No textbook formula gives its characteristic impedance exactly, so the designer solves the field numerically. This project takes one such line from a cross-section drawing to a matched, loss-budgeted transmission line, using the methods of the whole course: Laplace's equation and finite differences, capacitance from field energy, the TEM relation between , and , reflection and the quarter-wave transformer, skin-effect loss, and a SPICE cross-check. The final deliverable is a short engineering report.
The specification
| Item | Requirement |
|---|---|
| Line | square coax, outer channel inside, inner conductor a square bar of side |
| Filling | PTFE, , loss tangent near (an assumed round value: resin datasheets quote at , and pure-PTFE microwave substrates are specified at a few in the gigahertz range; check your material) |
| Impedance | |
| Load | a resistive load at the far end |
| Match | (VSWR , return loss ) at and over as wide a band as one quarter-wave section allows |
| Conductors | copper, |
Step 1: from a field solution to
For any lossless TEM line (two conductors, homogeneous filling), the inductance and capacitance per unit length satisfy , so a single electrostatic solution gives everything (The Distributed Line):
comes from the stored energy of the 2-D field with the inner conductor at (Electrostatic Energy):
The last form is exact for the five-point grid: each horizontal or vertical edge of a square cell of side carries a field component over an area , so cancels. The solver below builds the five-point Laplacian of Finite Differences for Laplace and Poisson as a sparse matrix and solves it directly (Sparse Matrices), which takes a fraction of a second even for unknowns.
Step 2: validate the solver on a case with an exact answer
Before trusting the solver on the square line, run it on a circular coax, whose capacitance is exact: (Capacitance). With and PTFE, needs , so ; the script uses ().
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import spsolve
EPS0, C0, ER = 8.854e-12, 2.998e8, 2.1 # PTFE filling
def laplace(fixed, val):
"""Solve Laplace's equation on a square grid; fixed nodes keep val."""
idx = -np.ones(fixed.shape, int)
unk = ~fixed
idx[unk] = np.arange(unk.sum())
I, J = np.nonzero(unk)
k = idx[I, J]
rows, cols, data = [k], [k], [np.full(k.size, 4.0)]
b = np.zeros(k.size)
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
nb = idx[I + di, J + dj]
inside = nb >= 0
rows.append(k[inside]); cols.append(nb[inside]); data.append(-np.ones(inside.sum()))
np.add.at(b, k[~inside], val[I[~inside] + di, J[~inside] + dj])
A = sp.csr_matrix((np.concatenate(data), (np.concatenate(rows), np.concatenate(cols))))
V = val.copy()
V[unk] = spsolve(A, b)
return V
def c_per_m(V):
"""C' = 2W'/V0^2 with V0 = 1 V: eps * sum of squared node differences."""
return ER * EPS0 * (np.sum(np.diff(V, axis=0)**2) + np.sum(np.diff(V, axis=1)**2))
def z0(c):
return np.sqrt(ER) / (C0 * c) # Z0 = sqrt(mu eps)/C' for a TEM line
a, b = 1.04e-3, 3.5e-3
c_exact = 2 * np.pi * ER * EPS0 / np.log(b / a)
print(f"circular coax exact: C' = {c_exact*1e12:.2f} pF/m, Z0 = {z0(c_exact):.2f} Ohm")
res = []
for n in [41, 81, 161]:
x = np.linspace(-1.05 * b, 1.05 * b, n)
X, Y = np.meshgrid(x, x)
r = np.hypot(X, Y)
c = c_per_m(laplace((r <= a) | (r >= b), np.where(r <= a, 1.0, 0.0)))
res.append(c)
print(f" n = {n:3d}, h = {(x[1]-x[0])*1e3:.4f} mm: C' = {c*1e12:.2f} pF/m, error {100*(c/c_exact-1):+.2f} %")
c_rich = 2 * res[2] - res[1]
print(f" Richardson (first order): C' = {c_rich*1e12:.2f} pF/m, error {100*(c_rich/c_exact-1):+.2f} %")circular coax exact: C' = 96.27 pF/m, Z0 = 50.21 Ohm
n = 41, h = 0.1837 mm: C' = 90.06 pF/m, error -6.45 %
n = 81, h = 0.0919 mm: C' = 93.28 pF/m, error -3.10 %
n = 161, h = 0.0459 mm: C' = 94.57 pF/m, error -1.76 %
Richardson (first order): C' = 95.86 pF/m, error -0.43 %
The error roughly halves each time halves: first-order convergence. The five-point stencil itself is second order, but round conductors drawn on a square grid become staircases, and the staircase moves the boundary by up to . Because the error falls predictably, Richardson extrapolation with () removes most of it. This is the validation habit of FEM, MoM and BEM: a solver earns trust by matching an exact case and by converging at the order you expect. A square line on a grid that puts its edges exactly on nodes has no staircase, so it should converge faster.
Step 3: design the square line
import numpy as np
import scipy.sparse as sp
from scipy.sparse.linalg import spsolve
import matplotlib.pyplot as plt
EPS0, C0, ER = 8.854e-12, 2.998e8, 2.1
S = 7e-3 # inside width of the square outer conductor
def laplace(fixed, val):
idx = -np.ones(fixed.shape, int)
unk = ~fixed
idx[unk] = np.arange(unk.sum())
I, J = np.nonzero(unk)
k = idx[I, J]
rows, cols, data = [k], [k], [np.full(k.size, 4.0)]
b = np.zeros(k.size)
for di, dj in [(1, 0), (-1, 0), (0, 1), (0, -1)]:
nb = idx[I + di, J + dj]
inside = nb >= 0
rows.append(k[inside]); cols.append(nb[inside]); data.append(-np.ones(inside.sum()))
np.add.at(b, k[~inside], val[I[~inside] + di, J[~inside] + dj])
A = sp.csr_matrix((np.concatenate(data), (np.concatenate(rows), np.concatenate(cols))))
V = val.copy()
V[unk] = spsolve(A, b)
return V
def z0_square(w, n):
"""Z0 of a square inner conductor (side w) centred in the square outer."""
x = np.linspace(-S / 2, S / 2, n)
X, Y = np.meshgrid(x, x)
inner = (np.abs(X) <= w / 2 + 1e-9) & (np.abs(Y) <= w / 2 + 1e-9)
fixed = inner.copy()
fixed[0, :] = fixed[-1, :] = fixed[:, 0] = fixed[:, -1] = True
V = laplace(fixed, np.where(inner, 1.0, 0.0))
c = ER * EPS0 * (np.sum(np.diff(V, axis=0)**2) + np.sum(np.diff(V, axis=1)**2))
return np.sqrt(ER) / (C0 * c), V
# mesh convergence at one width (w/2 lies on the grid for all three meshes)
for n in [36, 71, 141]:
print(f"w = 2.0 mm, h = {S/(n-1)*1e3:.2f} mm: Z0 = {z0_square(2.0e-3, n)[0]:.2f} Ohm")
# design sweep on the fine mesh, then interpolate for the two target impedances
ws = np.arange(1.2, 2.21, 0.1) * 1e-3
zs = np.array([z0_square(w, 141)[0] for w in ws])
for w, z in zip(ws, zs):
print(f" w = {w*1e3:.1f} mm -> {z:.2f} Ohm")
for target in [50.0, np.sqrt(50 * 75)]:
w_t = np.interp(target, zs[::-1], ws[::-1])
print(f"Z0 = {target:.2f} Ohm needs w = {w_t*1e3:.3f} mm")
z, V = z0_square(1.9e-3, 141)
x = np.linspace(-3.5, 3.5, 141)
plt.figure(figsize=(4.6, 4))
plt.contour(x, x, V, levels=np.linspace(0.1, 0.9, 9), cmap="viridis")
plt.gca().set_aspect("equal")
plt.title(f"Square coax, w = 1.9 mm: Z0 = {z:.2f} Ohm")
plt.xlabel("x (mm)"); plt.ylabel("y (mm)")
plt.show()w = 2.0 mm, h = 0.20 mm: Z0 = 51.99 Ohm
w = 2.0 mm, h = 0.10 mm: Z0 = 47.98 Ohm
w = 2.0 mm, h = 0.05 mm: Z0 = 48.09 Ohm
w = 1.2 mm -> 69.11 Ohm
w = 1.3 mm -> 65.82 Ohm
w = 1.4 mm -> 62.77 Ohm
w = 1.5 mm -> 59.92 Ohm
w = 1.6 mm -> 57.27 Ohm
w = 1.7 mm -> 54.77 Ohm
w = 1.8 mm -> 52.42 Ohm
w = 1.9 mm -> 50.20 Ohm
w = 2.0 mm -> 48.09 Ohm
w = 2.1 mm -> 46.09 Ohm
w = 2.2 mm -> 44.18 Ohm
Z0 = 50.00 Ohm needs w = 1.909 mm
Z0 = 61.24 Ohm needs w = 1.454 mm
Read the convergence first. The coarsest mesh is off, because the field is singular at the inner bar's four corners and resolves them badly; from to the answer moves only (), well inside the tolerance. A bar of gives ; machining tolerance of on moves by about (slope between and in the sweep), so the tolerance budget holds.
Step 4: match the load
Unmatched, the load reflects : VSWR , return loss . A quarter-wave section of transforms into exactly at the design frequency (Input Impedance and the Quarter-Wave Transformer). The solver says that section is a bar of , and its length is a quarter of the wavelength in PTFE.
import numpy as np
Z0, ZL, F0 = 50.0, 75.0, 1e9
Z1 = np.sqrt(Z0 * ZL)
ER, C0 = 2.1, 2.998e8
vp = C0 / np.sqrt(ER)
ell = vp / F0 / 4
print(f"Z1 = {Z1:.2f} Ohm, vp = {vp:.4e} m/s, quarter-wave length = {ell*1e3:.2f} mm")
gl = (ZL - Z0) / (ZL + Z0)
print(f"no match: Gamma = {gl:.3f}, VSWR = {(1+gl)/(1-gl):.2f}, return loss = {-20*np.log10(gl):.1f} dB")
def gamma_in(f):
bl = 2 * np.pi * f / vp * ell
zin = Z1 * (ZL + 1j * Z1 * np.tan(bl)) / (Z1 + 1j * ZL * np.tan(bl))
return (zin - Z0) / (zin + Z0)
for f in [0.6e9, 0.8e9, 1.0e9, 1.2e9, 1.4e9]:
g = abs(gamma_in(f))
print(f"f = {f/1e9:.1f} GHz: |Gamma_in| = {g:.4f}, VSWR = {(1+g)/(1-g):.3f}")
f = np.linspace(0.5e9, 1.5e9, 100001)
ok = f[np.abs(gamma_in(f)) <= 0.05]
print(f"|Gamma| <= 0.05 (VSWR <= 1.105) from {ok.min()/1e9:.3f} to {ok.max()/1e9:.3f} GHz ({(ok.max()-ok.min())/F0*100:.1f} %)")
# conductor and dielectric loss, estimated with the circular 50 Ohm reference line
MU0, SIG = 4e-7 * np.pi, 5.8e7
a, b = 1.04e-3, 3.5e-3
rs = np.sqrt(np.pi * F0 * MU0 / SIG)
rp = rs / (2 * np.pi) * (1 / a + 1 / b)
zc = 376.73 / (2 * np.pi * np.sqrt(ER)) * np.log(b / a)
ac = rp / (2 * zc)
ad = np.pi * F0 * np.sqrt(ER) * 2e-4 / C0
print(f"Rs = {rs*1e3:.2f} mOhm, R' = {rp:.3f} Ohm/m, alpha_c = {ac*8.686:.3f} dB/m, alpha_d = {ad*8.686:.4f} dB/m")Z1 = 61.24 Ohm, vp = 2.0688e+08 m/s, quarter-wave length = 51.72 mm
no match: Gamma = 0.200, VSWR = 1.50, return loss = 14.0 dB
f = 0.6 GHz: |Gamma_in| = 0.1191, VSWR = 1.270
f = 0.8 GHz: |Gamma_in| = 0.0630, VSWR = 1.134
f = 1.0 GHz: |Gamma_in| = 0.0000, VSWR = 1.000
f = 1.2 GHz: |Gamma_in| = 0.0630, VSWR = 1.134
f = 1.4 GHz: |Gamma_in| = 0.1191, VSWR = 1.270
|Gamma| <= 0.05 (VSWR <= 1.105) from 0.842 to 1.158 GHz (31.5 %)
Rs = 8.25 mOhm, R' = 1.638 Ohm/m, alpha_c = 0.142 dB/m, alpha_d = 0.0264 dB/m
One section meets over to , a fractional bandwidth; a wider band would need two or more sections (binomial or Chebyshev transformers, Communications, RF Engineering & Antennas). The loss estimate uses the circular reference line with the same : the skin-effect surface resistance (Lossy Media and Skin Effect) gives in the copper and in the PTFE, so a fixture loses about . The square line's current crowds into the bar's corners, so its conductor loss is somewhat higher; a fair report states that the estimate is low by an unknown few tens of per cent and how you would measure it.
Step 5: cross-check in SPICE
ngspice's lossless T element is a line with a given and one-way delay. A quarter-wave section at has . With a AC source behind , the wave sent into a matched line is , so :
cat > qw.cir <<'EOF'
* 50 Ohm source, quarter-wave 61.24 Ohm section (TD = 0.25 ns), 75 Ohm load
V1 src 0 AC 1
RS src in 50
T1 in 0 out 0 Z0=61.24 TD=0.25n
RL out 0 75
.control
ac lin 5 0.6g 1.4g
let gam = 2*v(in) - 1
let mag = abs(gam)
print frequency mag
.endc
.end
EOF
ngspice -b qw.cir 2>&1 | grep -E '^[0-9]'0 6.000000e+08 1.191268e-01
1 8.000000e+08 6.295273e-02
2 1.000000e+09 4.501131e-05
3 1.200000e+09 6.295273e-02
4 1.400000e+09 1.191268e-01
SPICE agrees with the Python formula to all printed digits; the left at is only because was rounded to .
Step 6: the unmatched line in the time domain
Without the transformer, a step launched from a matched source sees one reflection of and no further ones (). Set the lab to , , : it shows , , a launched wave of from the step, a final value of , VSWR and return loss . This is what a time-domain reflectometer would show you: a step of arriving back at the source after .
Guided lab: what you would measure
Hand calculation and simulation: steps 1 to 6.
Measurement (if you build it). Machine the line, fit SMA connectors at both ends and measure with a calibrated vector network analyser (VNA) from to :
- With a load: shows how close is to . A error gives (), so the connector transitions (a good SMA launch is typically somewhere around at , depending on the part and how it is fitted) can dominate. Time-gating on the VNA (or a TDR) separates the line from the connectors.
- With the transformer and load: expect the return-loss minimum near , shifted by if the section length is off (a error in moves it about , ).
- Insertion loss of a line through to a second port: the predicted is below a typical VNA's trace noise and connector repeatability ( to ), so a meaningful loss measurement needs a longer line or a resonator method (Cavity Resonators).
Hazards and safe setup. Signal levels are milliwatts from the VNA: no RF exposure concern. Protect the VNA's ports from electrostatic discharge (ground yourself, touch the outer shell first), never apply DC to its ports, and tighten SMA connectors with a torque wrench (commonly about , , for brass and , , for stainless steel; check the connector's datasheet). Machining swarf is sharp; deburr before handling.
Your write-up
Use this template (Writing Lab Reports):
- Objective: the specification table, in your words.
- Method: the TEM relation and energy method for , the solver (grid, boundary conditions, sparse direct solve), the validation case.
- Validation: the circular-coax table, the observed order of convergence, and the extrapolated error.
- Design: sweep, the chosen with its mesh-convergence evidence and machining tolerance, the transformer , its bar width and length.
- Performance: against frequency (Python and SPICE), the bandwidth, the loss budget with its stated uncertainty.
- Measurement plan or results: what you measured or would measure, expected readings, uncertainty, and the comparison.
- Conclusions and limits: what the 2-D TEM model ignores (connector transitions, the step discontinuity between the and bars, which adds a small fringing capacitance; higher-order modes, which start when the mean circumference of the cross-section approaches a wavelength in the filling: for the circular reference line ).
Extensions
- Replace the square bar with a round rod (diameter ) in the square channel and compare with the published approximation for that geometry; mind the staircase.
- Solve the field with a Jacobi or SOR iteration instead of the sparse solve and compare iteration counts with Jacobi and Gauss–Seidel.
- Design a two-section binomial transformer and plot both responses.
Test yourself
Why can one electrostatic field solution give the characteristic impedance of a lossless TEM line?
- because only at DC
- because , so follows from
- because the magnetic field is zero in a TEM line
- because depends only on the filling
Halving halves the capacitance error of the circular-coax solution. What does that tell you?
- the solver is wrong
- the method converges at first order, here limited by the staircase boundary
- the method is second order
- the grid is too fine
A quarter-wave transformer matches to . Its impedance is…
How long is a quarter-wave section at in PTFE ()?