filter_design
Passive LC ladder filter synthesis: Butterworth or Chebyshev, low-pass, high-pass or band-pass of order n for a cutoff and impedance. Prototype g values from the closed forms, inductors and capacitors, load resistance, attenuation at a stop frequency and the order a stop requirement needs. The response is computed from the finished ladder as a circuit (ABCD chain between the terminations) and compared with the closed form; response and element csv.
- Field
- Waves, optics and circuits
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.05 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001Butterworth n=3 low-pass, 1 MHz, 50 ohm: g = 2 sin((2k-1) pi/(2n)) = 1, 2, 1; C = g/(2 pi fc R), L = g R/(2 pi fc); 10 log10(2) = 3.0103 dB at cutoff read off the ladder (closed forms, 1e-9)passed
g.0{"value": 1.0, "rel_tol": 1e-09}g.1{"value": 2.0, "rel_tol": 1e-09}g.2{"value": 1.0, "rel_tol": 1e-09}elements.0.C_F{"value": 3.183098861837907e-09, "rel_tol": 1e-09}elements.1.L_H{"value": 1.5915494309189534e-05, "rel_tol": 1e-09}elements.2.C_F{"value": 3.183098861837907e-09, "rel_tol": 1e-09}load_ohm50 ± 5e-1150lockedunder 0.01 % of the tolerance usededge_attenuation_dB3.0103 ± 1e-093.0103lockedunder 0.01 % of the tolerance usedhalf_power_high_Hz1e+06 ± 0.0011e+06lockedunder 0.01 % of the tolerance usedr0002Butterworth n=5: g = 0.618034, 1.618034, 2, 1.618034, 0.618034 (golden ratio, (sqrt5 -+ 1)/2); ladder at 2 fc gives 10 log10(1 + 2^10) = 30.107239 dB (closed forms, 1e-9)passed
g.0{"value": 0.6180339887498949, "rel_tol": 1e-09}g.1{"value": 1.618033988749895, "rel_tol": 1e-09}g.2{"value": 2.0, "rel_tol": 1e-09}g.3{"value": 1.618033988749895, "rel_tol": 1e-09}g.4{"value": 0.6180339887498949, "rel_tol": 1e-09}stop_attenuation_dB30.1072 ± 3e-0830.1072lockedunder 0.01 % of the tolerance usededge_attenuation_dB3.0103 ± 1e-093.0103lockedunder 0.01 % of the tolerance usedr0003Pozar, Microwave Engineering, maximally flat low-pass example: 2 GHz, 50 ohm, at least 15 dB at 3 GHz -> N = 5, C1 = 0.984 pF, L2 = 6.438 nH, C3 = 3.183 pF (tolerance: half the last printed digit); 10 log10(1 + 1.5^10) = 17.6838 dBpassed
order_needed= 55lockedexact matchmeets_stop= truetruelockedexact matchelements.0.C_F{"value": 9.84e-13, "abs_tol": 5e-16}elements.1.L_H{"value": 6.438e-09, "abs_tol": 5e-13}elements.2.C_F{"value": 3.183e-12, "abs_tol": 5e-16}elements.3.L_H{"value": 6.438e-09, "abs_tol": 5e-13}elements.4.C_F{"value": 9.84e-13, "abs_tol": 5e-16}stop_attenuation_dB17.6838 ± 1.8e-0817.6838lockedunder 0.01 % of the tolerance usedr0004Butterworth n=3 high-pass T, 1 kHz, 50 ohm: C = 1/(g R 2 pi fc), L = R/(g 2 pi fc); ladder at fc/2 gives 10 log10(1 + 2^6) = 18.129134 dB; 3.0103 dB at cutoff (closed forms, 1e-9)passed
elements.0.C_F{"value": 3.183098861837907e-06, "rel_tol": 1e-09}elements.1.L_H{"value": 0.0039788735772973835, "rel_tol": 1e-09}elements.2.C_F{"value": 3.183098861837907e-06, "rel_tol": 1e-09}stop_attenuation_dB18.1291 ± 1.8e-0818.1291lockedunder 0.01 % of the tolerance usededge_attenuation_dB3.0103 ± 1e-093.0103lockedunder 0.01 % of the tolerance usedr0005Chebyshev 0.5 dB n=3: g = 1.5963, 1.0967, 1.5963 (Matthaei-Young-Jones table 4.05-2, also Pozar table 8.4; 4 printed decimals, tolerance 6e-5); ladder ripple at the passband edge = 0.5 dB; at 2 fc 10 log10(1 + eps^2 T3(2)^2), T3(2) = 26 -> 19.216057 dB; half-power at fc cosh(acosh(1/eps)/3)passed
g.0{"value": 1.5963, "abs_tol": 6e-05}g.1{"value": 1.0967, "abs_tol": 6e-05}g.2{"value": 1.5963, "abs_tol": 6e-05}g_load1 ± 1e-121lockedunder 0.01 % of the tolerance usededge_attenuation_dB0.5 ± 1e-090.5lockedunder 0.01 % of the tolerance usedstop_attenuation_dB19.2161 ± 1.9e-0819.2161lockedunder 0.01 % of the tolerance usedhalf_power_high_Hz1.16749e+06 ± 0.00121.16749e+06lockedunder 0.01 % of the tolerance usedpassband_return_loss_min_dB9.63574 ± 9.6e-099.63574lockedunder 0.01 % of the tolerance usedr0006Chebyshev n=1: g1 = 2 eps = 2 sqrt(10^(0.5/10) - 1) = 0.698623 exactly (closed form, 1e-9); ripple 0.5 dB at the edgepassed
g.0{"value": 0.6986228003778959, "rel_tol": 1e-09}edge_attenuation_dB0.5 ± 1e-090.5lockedunder 0.01 % of the tolerance usedr0007Chebyshev 0.5 dB n=2 (even order, unequal terminations): g = 1.4029, 0.7071, load 1.9841 (Matthaei-Young-Jones table 4.05-2 / Pozar table 8.4, 4 decimals); ladder ripple 0.5 dB at the edge; at 3 fc 10 log10(1 + eps^2 T2(3)^2), T2(3) = 17 -> 15.594677 dBpassed
g.0{"value": 1.4029, "abs_tol": 6e-05}g.1{"value": 0.7071, "abs_tol": 6e-05}g_load1.9841 ± 6e-051.98406locked74 % of the tolerance usededge_attenuation_dB0.5 ± 1e-090.5lockedunder 0.01 % of the tolerance usedstop_attenuation_dB15.5947 ± 1.6e-0815.5947lockedunder 0.01 % of the tolerance usedr0008Pozar, Microwave Engineering, band-pass example: 0.5 dB equal ripple, N = 3, 1 GHz centre, 10 % bandwidth, 50 ohm -> L1 = 127.0 nH, C1 = 0.199 pF, L2 = 0.726 nH, C2 = 34.91 pF (tolerance: half the last printed digit); ladder ripple 0.5 dB at both band edges; every resonator at 1 GHzpassed
elements.0.L_H{"value": 1.27e-07, "abs_tol": 5e-11}elements.0.C_F{"value": 1.99e-13, "abs_tol": 5e-16}elements.1.L_H{"value": 7.26e-10, "abs_tol": 5e-13}elements.1.C_F{"value": 3.491e-11, "abs_tol": 5e-15}elements.2.L_H{"value": 1.27e-07, "abs_tol": 5e-11}elements.0.resonance_Hz{"value": 1000000000.0, "rel_tol": 1e-09}elements.1.resonance_Hz{"value": 1000000000.0, "rel_tol": 1e-09}edge_attenuation_dB0.5 ± 1e-080.5lockedunder 0.01 % of the tolerance usededge_low_attenuation_dB0.5 ± 1e-080.5lockedunder 0.01 % of the tolerance usedfractional_bandwidth0.1 ± 1e-100.1lockedunder 0.01 % of the tolerance usedr0009Butterworth n=3 band-pass 9-11 MHz, 50 ohm: shunt C1 = g/(2 pi bw R), series L2 = g R/(2 pi bw), each resonant at sqrt(f1 f2); 3.0103 dB at both edges; at 12 MHz w = (f^2 - f1 f2)/(f bw) = 1.875 -> 10 log10(1 + 1.875^6) = 16.478892 dB (closed forms; 1e-8 because L - 1/C nearly cancel in band)passed
elements.0.C_F{"value": 1.5915494309189535e-09, "rel_tol": 1e-09}elements.0.L_H{"value": 1.6076256877969226e-07, "rel_tol": 1e-09}elements.1.L_H{"value": 7.957747154594767e-06, "rel_tol": 1e-09}elements.1.C_F{"value": 3.215251375593845e-11, "rel_tol": 1e-09}center_Hz9.94987e+06 ± 0.00999.94987e+06lockedunder 0.01 % of the tolerance usedstop_normalised1.875 ± 1.9e-091.875lockedunder 0.01 % of the tolerance usededge_attenuation_dB3.0103 ± 1e-083.0103lockedunder 0.01 % of the tolerance usededge_low_attenuation_dB3.0103 ± 1e-083.0103lockedunder 0.01 % of the tolerance usedstop_attenuation_dB16.4789 ± 1.6e-0716.4789lockedunder 0.01 % of the tolerance used
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
family | butterworth | Butterworth (maximally flat, cutoff at -3.01 dB) or Chebyshev (equal ripple, cutoff at the ripple edge). | |
response | lowpass | ||
order | 1 | 3 | Number of reactive elements (low/high-pass) or resonators (band-pass). |
cutoff_Hz | Hz | 1000000.0 | Passband edge of a low-pass or high-pass. Not used for a band-pass. |
band_low_Hz | Hz | Band-pass: lower passband edge (with band_high_Hz). | |
band_high_Hz | Hz | Band-pass: upper passband edge (with band_low_Hz). | |
center_Hz | Hz | Band-pass, instead of the two edges: centre frequency, the geometric mean of the edges (with bandwidth_Hz). | |
bandwidth_Hz | Hz | Band-pass, with center_Hz: upper edge minus lower edge. | |
impedance_ohm | ohm | 50.0 | Source resistance. The load is the same except for an even-order Chebyshev (see load_ohm). |
ripple_dB | 0.5 | Chebyshev passband ripple. Ignored for Butterworth. | |
first_element | shunt | shunt: pi ladder (low-pass starts with a capacitor to ground). series: T ladder (low-pass starts with an inductor). | |
stop_Hz | Hz | Optional: a frequency to read the attenuation at. | |
stop_attenuation_min_dB | Optional, with stop_Hz: the attenuation wanted there. Gives meets_stop and order_needed. | ||
points | 1 | 201 | Rows of response.csv, log spaced. |
sweep_min_Hz | Hz | Optional: start of the response sweep (default a decade below the cutoff). | |
sweep_max_Hz | Hz | Optional: end of the response sweep (default a decade above the cutoff). |
Readings
| Name | Unit | Meaning |
|---|---|---|
order | 1 | |
g | 1 | Prototype values g_1..g_n (1 ohm, 1 rad/s). |
g_load | 1 | g_(n+1): 1, or coth^2(beta/4) for an even-order Chebyshev. |
ripple_dB | ||
source_ohm | ohm | |
load_ohm | ohm | |
elements | The ladder, source side first: name, branch (series or shunt), type, g, L_H, C_F, resonance_Hz, value as text. | |
cutoff_Hz | Hz | |
band_low_Hz | Hz | |
band_high_Hz | Hz | |
center_Hz | Hz | |
fractional_bandwidth | 1 | |
edge_attenuation_dB | Attenuation of the ladder as built at the cutoff (band-pass: at the upper edge). | |
edge_low_attenuation_dB | Band-pass: the same at the lower edge. | |
half_power_low_Hz | Hz | |
half_power_high_Hz | Hz | |
passband_return_loss_min_dB | Chebyshev: worst passband return loss, -10 log10(1 - 10^(-ripple/10)). | |
stop_Hz | Hz | |
stop_normalised | 1 | The low-pass prototype frequency stop_Hz maps to. |
stop_attenuation_dB | Attenuation of the ladder as built at stop_Hz (circuit analysis). | |
stop_attenuation_formula_dB | The closed form at stop_Hz: 10 log10(1 + w^2n), or 10 log10(1 + eps^2 Tn(w)^2). | |
stop_attenuation_min_dB | ||
meets_stop | true when the attenuation at stop_Hz reaches stop_attenuation_min_dB. | |
order_needed | 1 | Smallest order whose closed-form attenuation at stop_Hz reaches the requirement. |
synthesis_error_dB | Largest gap between the ladder's response and the closed form over the sweep and the band edges. | |
points_compared | 1 | |
sweep_min_Hz | Hz | |
sweep_max_Hz | Hz | |
all_ok | true when the ladder reproduces the closed form within 1e-6 dB and any stop requirement is met. | |
warnings | ||
notes | ||
files | out/response.csv (f_Hz, attenuation_dB, formula_dB, return_loss_dB, phase_deg), out/elements.csv |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.