Radiation pattern
Antenna Engineering — 8-element ULA, broadside
Example from the compendium of canonical charts
Python Code
"""Antenna Engineering — Radiation pattern (8-element ULA, broadside)."""
import numpy as np
import plotly.graph_objects as go
def generate():
N = 8 # elements
d = 0.5 # spacing in wavelengths
beta = 0.0 # progressive phase shift (broadside)
theta = np.linspace(0, 2 * np.pi, 3600)
# Phase difference per element
psi = 2 * np.pi * d * np.cos(theta) + beta
# Array factor: use sinc-like formula; handle ψ→0
# AF = sin(N*ψ/2) / sin(ψ/2)
half_psi = psi / 2
with np.errstate(divide="ignore", invalid="ignore"):
AF = np.where(
np.abs(np.sin(half_psi)) < 1e-10,
float(N),
np.abs(np.sin(N * half_psi) / np.sin(half_psi)),
)
AF_norm = AF / N # normalize main lobe to 1.0
# Convert to dB and clip at -40 dB
AF_dB = 20 * np.log10(AF_norm + 1e-10)
AF_dB = np.maximum(AF_dB, -40.0)
# Shift to positive for scatterpolar (add 40)
r_vals = AF_dB + 40 # range [0, 40]
fig = go.Figure()
fig.add_trace(go.Scatterpolar(
r=r_vals,
theta=np.degrees(theta),
mode="lines",
name="Array factor",
line=dict(color=VIOLET, width=2),
hovertemplate="θ=%{theta:.1f}°, %{r:.1f}−40 dB<extra></extra>",
))
fig.update_layout(
polar=dict(
radialaxis=dict(
range=[0, 42],
tickvals=[0, 10, 20, 30, 40],
ticktext=["−40", "−30", "−20", "−10", "0"],
title="dB",
),
angularaxis=dict(direction="clockwise", rotation=90),
),
legend=dict(orientation="h", y=1.06),
margin=dict(t=60, b=60, l=60, r=60),
height=560,
)
return fig
if __name__ == "__main__":
generate()
Made with Plotly