antenna_array
Linear antenna array of equally spaced isotropic elements: the array factor against angle from the array axis for N elements, spacing in wavelengths and a progressive phase step (or a steering angle), with uniform, binomial, Dolph-Chebyshev or custom symmetric amplitude taper. Gives beam direction, half-power and first-null beamwidths, every null, first and highest sidelobe, directivity (exact sum), and a grating-lobe check. Array factor only: element pattern, mutual coupling and losses are not modelled.
- 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
r0001uniform broadside N = 4, d = lambda/2 (Balanis, Antenna Theory, sec. 6.3): nulls at cos(theta) = m lambda/(N d) = 0, +-1/2, +-1 -> 0, 60, 120, 180 deg; AF = cos(psi/2) cos(psi), so the sidelobe is 2/(3 sqrt 6) = -11.3033 dB and the half-power point solves cos(psi/2) cos(psi) = 1/sqrt 2; half-wave spacing gives D = N = 4; closed forms, 1e-6passed
beam_angle_deg90 ± 1e-0990lockedunder 0.01 % of the tolerance usednull_count= 44lockedexact matchnulls_deg.0{"value": 0.0, "abs_tol": 1e-06}nulls_deg.1{"value": 60.0, "abs_tol": 1e-06}nulls_deg.2{"value": 120.0, "abs_tol": 1e-06}nulls_deg.3{"value": 180.0, "abs_tol": 1e-06}fnbw_deg60 ± 1e-0660lockedunder 0.01 % of the tolerance usedfirst_sidelobe_db-11.3033 ± 1e-06-11.3033lockedunder 0.01 % of the tolerance usedhpbw_deg26.323 ± 1e-0626.323lockedunder 0.01 % of the tolerance useddirectivity4 ± 4e-094lockedunder 0.01 % of the tolerance usedgrating_lobe_free= truetruelockedexact matchr0002uniform broadside N = 3, d = lambda/2: AF = (1 + 2 cos psi)/3, nulls at cos(theta) = +-2/3, one sidelobe each side at endfire of level 1/3 = -9.5424 dB, D = N = 3; closed forms, 1e-6passed
null_count= 22lockedexact matchfirst_null_low_deg48.1897 ± 1e-0648.1897lockedunder 0.01 % of the tolerance usedfirst_null_high_deg131.81 ± 1e-06131.81lockedunder 0.01 % of the tolerance usedsidelobe_count= 22lockedexact matchfirst_sidelobe_db-9.54243 ± 1e-06-9.54243lockedunder 0.01 % of the tolerance useddirectivity3 ± 3e-093lockedunder 0.01 % of the tolerance usedr0003two elements in phase, d = lambda/2: AF = cos((pi/2) cos theta), no sidelobe, nulls on the axis (0 and 180 deg), half power at cos(theta) = +-1/2 so HPBW = 60 deg, D = 2; closed forms, 1e-6passed
sidelobe_count= 00lockedexact matchfirst_sidelobe_db= lockedexact matchhpbw_deg60 ± 1e-0660lockedunder 0.01 % of the tolerance usedfirst_null_low_deg0 ± 1e-060lockedunder 0.01 % of the tolerance usedfirst_null_high_deg180 ± 1e-06180lockedunder 0.01 % of the tolerance useddirectivity2 ± 2e-092lockedunder 0.01 % of the tolerance usedr0004two elements in phase, d = lambda/4: D = 2/(1 + sin(k d)/(k d)) = 2/(1 + 2/pi) = 1.2220309 (Kraus, Antennas, two isotropic sources); no null and no sidelobe (the pattern is exactly at half power on the axis, cos^2(pi/4) = 1/2, so the beamwidth is not graded); closed form, 1e-9passed
directivity1.22203 ± 1.2e-091.22203lockedunder 0.01 % of the tolerance usednull_count= 00lockedexact matchsidelobe_count= 00lockedexact matchr0005steering, N = 8, d = lambda/2, beta = -90 deg: peak where k d cos(theta) + beta = 0 -> cos(theta) = 1/2, 60 deg; first nulls at psi = +-2 pi/N -> cos(theta) = 3/4 and 1/4; half-power point solves sin(4 psi)/(8 sin(psi/2)) = 1/sqrt 2; half-wave spacing gives D = N = 8 at any scan; closed forms, 1e-6passed
beam_angle_deg60 ± 1e-0960lockedunder 0.01 % of the tolerance usedfirst_null_low_deg41.4096 ± 1e-0641.4096lockedunder 0.01 % of the tolerance usedfirst_null_high_deg75.5225 ± 1e-0675.5225lockedunder 0.01 % of the tolerance usedfnbw_deg34.1129 ± 1e-0634.1129lockedunder 0.01 % of the tolerance usedhpbw_deg14.8356 ± 1e-0614.8356lockedunder 0.01 % of the tolerance useddirectivity8 ± 8e-098lockedunder 0.01 % of the tolerance usedmax_spacing_no_grating_wavelengths0.666667 ± 6.7e-100.666667lockedunder 0.01 % of the tolerance usedr0006ordinary endfire, N = 10, d = lambda/4, beta = -k d = -90 deg (Balanis sec. 6.3.3): beam on the axis, first null at cos(theta) = 1 - lambda/(N d) = 0.6 -> 53.1301 deg, FNBW twice that; HPBW = 2 acos(1 - psi_h/(k d)) with sin(5 psi_h)/(10 sin(psi_h/2)) = 1/sqrt 2; every lag term sin(2 l k d) vanishes so D = N = 10; closed forms, 1e-6passed
beam_angle_deg0 ± 1e-060lockedunder 0.01 % of the tolerance usedfirst_null_high_deg53.1301 ± 1e-0653.1301lockedunder 0.01 % of the tolerance usedfnbw_deg106.26 ± 1e-06106.26lockedunder 0.01 % of the tolerance usedhpbw_deg69.4185 ± 1e-0669.4185lockedunder 0.01 % of the tolerance useddirectivity10 ± 1e-0810lockedunder 0.01 % of the tolerance usedr0007large-N asymptotes at N = 200, d = lambda/2: first sidelobe tends to the sinc value -13.2615 dB (tan x = x at x = 4.4934; the N = 200 value differs by x^2/(6 N^2) = 0.0007 dB, so abs_tol 0.002 dB) and HPBW tends to 0.8859 lambda/(N d) rad = 0.50758 deg (terms of order 1/N^2 dropped, so rel_tol 1e-4); D = N = 200 exactlypassed
first_sidelobe_db-13.2615 ± 0.002-13.2607locked37 % of the tolerance usedhpbw_deg0.507579 ± 5.1e-050.507586locked14 % of the tolerance useddirectivity200 ± 2e-07200lockedunder 0.01 % of the tolerance usednull_count= 200200lockedexact matchr0008Dolph-Chebyshev N = 10, 26 dB, d = lambda/2 (Dolph 1946): AF = T9(x0 cos(psi/2)), T9(x0) = R: every sidelobe at -26 dB, first nulls where x0 cos(psi/2) = cos(pi/18), half power where T9 = R/sqrt 2 -> cosh(acosh(R/sqrt 2)/9)/x0; closed forms, 1e-6passed
first_sidelobe_db-26 ± 1e-06-26lockedunder 0.01 % of the tolerance usedmax_sidelobe_db-26 ± 1e-06-26lockedunder 0.01 % of the tolerance usedfirst_null_low_deg73.9909 ± 1e-0673.9909lockedunder 0.01 % of the tolerance usedfirst_null_high_deg106.009 ± 1e-06106.009lockedunder 0.01 % of the tolerance usedhpbw_deg12.3459 ± 1e-0612.3459lockedunder 0.01 % of the tolerance usednull_count= 1010lockedexact matchr0009Dolph-Chebyshev N = 3, 20 dB (R = 10): T2(x0 cos(psi/2)) = (x0^2 - 1) + x0^2 cos(psi) with x0^2 = (R + 1)/2, so centre/edge = 2 (R - 1)/(R + 1) = 18/11 and the sidelobe is -20 dB; closed forms, 1e-9 and 1e-6 dBpassed
centre_over_edge1.63636 ± 1.6e-091.63636lockedunder 0.01 % of the tolerance usedmax_sidelobe_db-20 ± 1e-06-20lockedunder 0.01 % of the tolerance usedr0010Dolph-Chebyshev weights N = 8, 30 dB, d = lambda/2: T7(x0 z), z = cos(psi/2), x0 = cosh(acosh(10^1.5)/7), expanded as a polynomial in z and turned into harmonics with cos^p = 2^-p sum C(p, j) cos((p - 2j) psi/2) (algebra, not the program's Fourier sum): weights 0.26221649, 0.51874705, 0.81196007, 1 (largest = 1); half-wave broadside so D = (sum a)^2/sum a^2 = 6.7328972; first null where x0 z = cos(pi/14); half power where T7 = R/sqrt 2; closed forms, 1e-9 relative and 1e-6 deg or dBpassed
weights.0{"value": 0.2622164911915371, "rel_tol": 1e-09}weights.1{"value": 0.5187470541275406, "rel_tol": 1e-09}weights.2{"value": 0.8119600672627029, "rel_tol": 1e-09}weights.3{"value": 1.0, "rel_tol": 1e-12}weights.7{"value": 0.2622164911915371, "rel_tol": 1e-09}directivity6.7329 ± 6.7e-096.7329lockedunder 0.01 % of the tolerance usedmax_sidelobe_db-30 ± 1e-06-30lockedunder 0.01 % of the tolerance usedfirst_null_low_deg67.573 ± 1e-0667.573lockedunder 0.01 % of the tolerance usedhpbw_deg16.4432 ± 1e-0616.4432lockedunder 0.01 % of the tolerance usednull_count= 88lockedexact matchr0011binomial N = 5, d = lambda/2 (Stone's array): AF = cos^4(psi/2), no sidelobe, nulls only on the axis, HPBW = 2 asin((2/pi) acos(2^(-1/8))) = 30.2826 deg, D = (sum a)^2/sum a^2 = 256/70; closed forms, 1e-6passed
sidelobe_count= 00lockedexact matchnull_count= 22lockedexact matchhpbw_deg30.2826 ± 1e-0630.2826lockedunder 0.01 % of the tolerance useddirectivity3.65714 ± 3.7e-093.65714lockedunder 0.01 % of the tolerance usedcentre_over_edge6 ± 6e-126lockedunder 0.01 % of the tolerance usedr0012grating lobe: N = 8, d = 0.7 lambda steered to 60 deg: beta = -360 (0.7)(0.5) = -126 deg; d exceeds 1/(1 + |cos 60|) = 2/3 lambda, so psi = -360 deg is visible at cos(theta) = 1/2 - 1/0.7 -> 158.2132 deg; closed forms, 1e-6passed
phase_deg-126 ± 1e-09-126lockedunder 0.01 % of the tolerance usedbeam_angle_deg60 ± 1e-0960lockedunder 0.01 % of the tolerance usedgrating_lobe_free= falsefalselockedexact matchgrating_lobe_count= 11lockedexact matchgrating_lobe_angles_deg.0{"value": 158.2132107017382, "abs_tol": 1e-06}max_spacing_no_grating_wavelengths0.666667 ± 6.7e-100.666667lockedunder 0.01 % of the tolerance usedr0013custom weights [1, 3, 3, 1], d = lambda/2: AF = cos^3(psi/2) (the N = 4 binomial array given by hand): nulls only on the axis, no sidelobe, D = (sum a)^2/sum a^2 = 64/20 = 3.2, HPBW =2 asin((2/pi) acos(2^(-1/6))) = 34.9334 deg; closed forms, 1e-6passed
n_elements= 44lockedexact matchnull_count= 22lockedexact matchsidelobe_count= 00lockedexact matchdirectivity3.2 ± 3.2e-093.2lockedunder 0.01 % of the tolerance usedhpbw_deg34.9334 ± 1e-0634.9334lockedunder 0.01 % of the tolerance usedr0014main beam outside visible space: 4 elements at a quarter wavelength with a 180 deg phase step; |beta| = 180 deg exceeds k d = 90 deg, so there is no full-strength peak and the verdict must fail (closed form: visible only when |beta| <= 360 deg * d/lambda)passed
main_beam_visible= falsefalselockedexact matchsingle_main_beam= falsefalselockedexact match
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 |
|---|---|---|---|
n_elements | 1 | 8 | Number of elements N. With taper = custom the number of weights is used instead. |
spacing_wavelengths | 1 | 0.5 | Element spacing divided by the wavelength, d / lambda. |
phase_deg | deg | 0 | Progressive phase beta from one element to the next. 0 is broadside; -360 d / lambda is endfire toward 0 deg. Ignored when steer_angle_deg is given. |
steer_angle_deg | deg | Optional: point the beam at this angle from the array axis (90 = broadside); sets beta = -360 (d / lambda) cos(angle) deg. | |
taper | uniform | Amplitude taper. binomial: C(N-1, n), no sidelobes at half-wave spacing. chebyshev: Dolph-Chebyshev, all sidelobes at sidelobe_db. custom: the weights input. | |
sidelobe_db | 26 | Chebyshev taper only: sidelobe level below the main beam, a positive number of dB. | |
weights | taper = custom only: one real amplitude per element, zero or positive, symmetric about the centre, 2 to 500 values. |
Readings
| Name | Unit | Meaning |
|---|---|---|
n_elements | 1 | |
taper | 1 | |
spacing_wavelengths | 1 | |
array_length_wavelengths | 1 | (N - 1) d / lambda |
phase_deg | deg | the progressive phase used |
main_beam_visible | 1 | false when |beta| > k d: no full-strength peak in visible space |
beam_angle_deg | deg | main-beam direction from the array axis: cos(theta) = -beta / (k d) |
beam_from_broadside_deg | deg | 90 - beam_angle_deg |
hpbw_deg | deg | half-power beamwidth; for a beam on the axis, twice the angle from the axis to the half-power point; null when the pattern never drops 3 dB |
half_power_low_deg | deg | |
half_power_high_deg | deg | |
fnbw_deg | deg | width between the first nulls either side of the main beam |
first_null_low_deg | deg | |
first_null_high_deg | deg | |
null_count | 1 | |
nulls_deg | deg | every null in 0 to 180 deg, ascending (first 200; out/nulls.csv holds all) |
sidelobe_count | 1 | lobe peaks in 0 to 180 deg other than the main beam and grating lobes |
first_sidelobe_db | dB relative to the main beam: the higher of the two lobes next to the main beam; null when there is none | |
first_sidelobe_angle_deg | deg | |
max_sidelobe_db | dB relative to the main beam: the highest sidelobe (grating lobes are counted separately) | |
max_sidelobe_angle_deg | deg | |
directivity | 1 | peak power over the average over the sphere, isotropic elements |
directivity_db | 10 log10(directivity), dBi | |
directivity_check_rel_diff | 1 | relative gap between the exact sum and Simpson's rule for the sphere average |
taper_efficiency | 1 | (sum a)^2 / (N sum a^2) |
centre_over_edge | 1 | largest weight over the end element's weight |
weights | 1 | element amplitudes, largest = 1 (first 200; out/weights.csv holds all) |
grating_lobe_free | 1 | true when no second full-strength peak (psi = 360 m deg) is in visible space |
single_main_beam | true when the main beam is in visible space and no grating lobe is: the verdict | |
grating_lobe_count | 1 | |
grating_lobe_angles_deg | deg | |
max_spacing_no_grating_wavelengths | 1 | 1 / (1 + |cos(beam angle)|): below this spacing no grating-lobe peak enters visible space; files: out/pattern.csv, out/lobes.csv, out/nulls.csv, out/weights.csv |
warnings | 1 |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.