Smith chart helpers.
A Smith chart plots the reflection coefficient Γ = (Z - 1) / (Z + 1)
on the unit disk, where Z = r + jx is a normalized complex impedance
(usually normalized to Z₀ = 50 Ω). Constant-resistance circles and
constant-reactance arcs form the classical grid.
BLAND's approach: use a Cartesian figure where the x-axis is
Re(Γ) and the y-axis is Im(Γ). Bland.smith_figure/1 sets the
plot area up as a unit disk; Bland.smith_grid/2 draws the
resistance circles and reactance arcs. User data is plotted as
reflection coefficients (Γ values) directly — convert from
impedance via gamma_from_z/1.
Examples
iex> {re, im} = Bland.Smith.gamma_from_z({1.0, 0.0})
iex> {Float.round(re, 6), Float.round(im, 6)}
{0.0, 0.0}
iex> {re, im} = Bland.Smith.gamma_from_z({0.0, 0.0})
iex> {Float.round(re, 6), Float.round(im, 6)}
{-1.0, 0.0}
Summary
Functions
Default resistance values (normalized) at which to draw the constant-R
circles: [0.2, 0.5, 1.0, 2.0, 5.0].
Default reactance magnitudes at which to draw the constant-X arcs.
Each positive value also draws its negative counterpart:
[±0.2, ±0.5, ±1.0, ±2.0, ±5.0].
Converts normalized impedance {r, x} to reflection coefficient
{Re(Γ), Im(Γ)}.
Full circle of constant normalized resistance r, traced in the
Γ-plane. Returns {xs, ys} with n + 1 points.
Full circle of constant normalized reactance x in the Γ-plane.
Returns {xs, ys} with n + 1 points.
Inverse: reflection coefficient {Γ_re, Γ_im} to normalized
impedance {r, x}. Z = (1 + Γ) / (1 − Γ).
Functions
@spec default_r_values() :: [float()]
Default resistance values (normalized) at which to draw the constant-R
circles: [0.2, 0.5, 1.0, 2.0, 5.0].
@spec default_x_values() :: [float()]
Default reactance magnitudes at which to draw the constant-X arcs.
Each positive value also draws its negative counterpart:
[±0.2, ±0.5, ±1.0, ±2.0, ±5.0].
Converts normalized impedance {r, x} to reflection coefficient
{Re(Γ), Im(Γ)}.
For Z = r + jx, Γ = (Z − 1) / (Z + 1).
@spec r_circle(number(), pos_integer()) :: {[float()], [float()]}
Full circle of constant normalized resistance r, traced in the
Γ-plane. Returns {xs, ys} with n + 1 points.
The circle has center (r/(r+1), 0) and radius 1/(r+1); it sits
entirely inside the unit disk, tangent at (1, 0).
@spec x_arc(number(), pos_integer()) :: {[float()], [float()]}
Full circle of constant normalized reactance x in the Γ-plane.
Returns {xs, ys} with n + 1 points.
Center is (1, 1/x), radius is 1/|x|. Only the portion inside
the unit disk is meaningful on a Smith chart; the series-layer clip
(clip: :circle) masks the rest.
Inverse: reflection coefficient {Γ_re, Γ_im} to normalized
impedance {r, x}. Z = (1 + Γ) / (1 − Γ).