1---
2version: 0.1.0
3precision: 3
4form_title: SWR Sweep
5form_description: SWR across the band for a resonant antenna. Enter resonant frequency and Q — read off SWR at the band edges, the 2:1 bandwidth, and the whole curve as a chart.
6form_inputs: Resonant frequency (MHz)|f0, Q factor|Q, Band start (MHz)|f_start, Band end (MHz)|f_end
7form_outputs: SWR at band start|swr_start, SWR at band end|swr_end, 2:1 bandwidth (kHz)|bw_khz, Lower 2:1 edge (MHz)|f_low, Upper 2:1 edge (MHz)|f_high
8form_plots: 1
9---
10# draftply Pro — SWR Sweep
11# "Does my antenna cover the whole band?"
12#
13# Model: a series-resonant antenna that is matched at resonance (its
14# feed-point resistance equals the line impedance there). Off resonance
15# the reactance climbs and the SWR with it. Q is what you measure:
16# a full-size wire dipole sits around 12, a loaded mobile whip near 200.
17
18# ── Your antenna ───────────────────────────────
19f0 = 14.2 # MHz, resonant frequency
20Q = 50 # loaded Q at the feed point
21
22f_start = 14.0 # MHz, band edge
23f_end = 14.35 # MHz, band edge
24
25# ── The model ──────────────────────────────────
26# Normalised reactance, reflection coefficient, SWR.
27xn(f) = Q * (f / f0 - f0 / f)
28gam(f) = abs(xn(f)) / sqrt(4 + xn(f)^2)
29swr(f) = (1 + gam(f)) / (1 - gam(f))
30
31# Return loss for the same point, in dB.
32rl(f) = -20 * log10(gam(f))
33
34swr_start = swr(f_start)
35swr_end = swr(f_end)
36
37"SWR at resonance": swr(f0)
38"SWR at band start": swr_start
39"SWR at band end": swr_end
40"Return loss at band start (dB)": rl(f_start)
41"Return loss at band end (dB)": rl(f_end)
42
43# ── 2:1 bandwidth ──────────────────────────────
44# SWR = 2 means |Γ| = 1/3, which happens at a normalised reactance of
45# √0.5. Solving f/f0 − f0/f = ±√0.5/Q for f gives the two band edges —
46# and their difference is simply f0·√0.5/Q.
47k = sqrt(0.5) / Q
48f_low = f0 * (sqrt(k^2 + 4) - k) / 2
49f_high = f0 * (sqrt(k^2 + 4) + k) / 2
50bw_khz = (f_high - f_low) * 1000
51
52"Lower 2:1 edge (MHz)": f_low
53"Upper 2:1 edge (MHz)": f_high
54"2:1 bandwidth (kHz)": bw_khz
55
56# Half-power bandwidth, for comparison — always the wider of the two.
57"-3 dB bandwidth (kHz)": f0 / Q * 1000
58
59# ── The curve ──────────────────────────────────
60plot(swr(x), f_start..f_end, "SWR across the band", "MHz", "SWR")
61