Modeling Antennas with Python: No NEC or MMANA Required

Modeling Antennas Without NEC or MMANA

You don’t need NEC, MMANA, or other dedicated antenna simulators to explore how antennas behave. At its core, antenna pattern prediction is applied physics: wave equations, geometry, and a summation of contributions from small segments of wire. Modern tools like NumPy and Matplotlib make it possible to translate those equations directly into working simulations in just a few lines of Python.

The Math Behind the Patterns

Whether you’re looking at a single dipole, a multi-element Yagi, or a triangular loop array, the underlying calculation is the same: sum the far-field contributions from each short current element.

  • Step 1 — Discretize the antenna: Break the physical wire(s) into many short segments, each small compared to a wavelength. For each segment, note its 3D position and direction.
  • Step 2 — Assign currents: For resonant wires, this might be a sinusoidal distribution. For traveling-wave antennas, currents can have a phase ramp along the wire.
  • Step 3 — Define observation angles: Represent the far-field directions as unit vectors for azimuth and elevation sweeps.
  • Step 4 — Calculate each segment’s contribution: The electric field strength is proportional to: |t̂ × r̂| · ej k (r̂ · rmid) where:
    • = unit vector along the segment
    • = unit vector pointing toward the observation point
    • rmid = segment’s midpoint
    • k = wave number = 2π/λ
  • Step 5 — Sum over all segments: Add the complex contributions for all segments to get the total field in that direction.
  • Step 6 — Normalize: Divide by the maximum value to get a relative gain pattern.

This is exactly what NEC does internally — but here you can see and control every step, and adapt it to non-standard geometries.

Arrays and Phase Control

Multi-element arrays, such as three-element equilateral triangles, can be modeled just as easily. You position each radiator in space, assign each one a phase shift, and sum their contributions. Changing the phase relationships simulates beam steering without re-running complex electromagnetic solvers.

For example:

  • Element positions: Defined in wavelengths for the chosen spacing.
  • Phases: Apply a constant offset to each element’s excitation to point the beam.
  • Rotation: Sweep azimuth angles to visualize steering in real time.

Why This Works

The far-field radiation of a thin-wire antenna is well described by the Hertzian dipole model summed over all wire segments. By handling the segmentation, phasing, and geometry yourself, you can model:

  • Single-wire antennas (dipoles, inverted-V, OCFD)
  • Folded or terminated loops
  • Triangular, square, or irregular arrays
  • Traveling-wave structures like Beverages or long wires

Ground effects, conductor diameter, and near-field coupling can be added as needed — but for understanding why a pattern looks the way it does, this approach is more than enough.

Advantages Over Black-Box Simulators

  • Transparency: Every variable and formula is under your control.
  • Speed: Simple Python + NumPy runs in milliseconds for thousands of points.
  • Flexibility: Model odd geometries or feed arrangements without fighting a GUI.
  • Educational value: By coding the physics directly, you learn why the lobes and nulls appear.

From Code to Insight

Once you have the math in place, the fun starts. You can animate beam steering, compare azimuth cuts at different elevations, or sweep frequency to see how a fixed geometry changes behavior across bands. For antenna designers, it’s a fast way to verify concepts before building.

Mini-FAQ

  • Is this as accurate as NEC? — For far-field pattern shape and relative gain, yes. NEC adds full EM boundary conditions and wire interactions for maximum accuracy, but the math here matches the physics behind it.
  • Can I model ground effects? — Yes, by adding image currents (mirror the antenna below the ground plane) and adjusting height.
  • Does this work for receive antennas? — Absolutely. Receive patterns follow the same physics as transmit patterns.
  • How many segments should I use? — Typically 20–50 segments per half-wavelength gives smooth results without excessive computation.
Pattern is an idealized model — not a direct prediction of real-world performance.

Interested in more technical content? Subscribe to our updates for deep-dive RF articles and lab notes.

Questions or experiences to share? Feel free to contact RF.Guru.

Joeri Van Dooren, ON6URE – RF, electronics, and software engineer, complex platform and antenna designer. Founder of RF.Guru. Expert in active and passive antennas, high-power RF transformers, and custom RF solutions. Has also engineered telecom and broadcast hardware, including set-top boxes, transcoders, and E1/T1 switchboards, with expertise spanning high-power RF, embedded systems, DSP, and complex software platforms.