# Antennas

## The Basics

Marconi provides an object for storing and handling radiation pattern data as an interface to working with antennas. This library doesn't intend to ever replace a full-wave solver, but hopefully will provide functions to get started with designing basic antennas and arrays.

To try to provide some semblance of consistency, most everything involving antennas will be in the order of $\phi$, $\theta$. This includes the indexing into array data. These angles are in degrees for all of the functions in Marconi.

### Radiation Patterns

This `RadiationPattern`

object can be constructed in a few ways. The default constructor accepts a range or array of azimuth from the x-axis - $\phi$, the elevation towards -z from the z axis $\theta$, and a 2D matrix of the pattern data represented by those spherical points. This data matrix is stored in dBi, or dB above isotropic.

To construct an isotropic radiator, for example:

```
using Marconi
ϕ = 0:360
θ = 0:180
data = zeros(Float64,(length(ϕ),length(θ)))
isotropic = RadiationPattern(ϕ,θ,data)
```

```
65341-Element Radiation Pattern
Φ: 0 - 360 deg in 1 deg steps
θ: 0 - 180 deg in 1 deg steps
Min: 0.0 dBi
Max: 0.0 dBi
```

The patterns we can generate within Marconi are limited, so most of the pattern data will come from outside sources. Most of what I use this for is importing simulated data from HFSS. This format is a simple CSV file, following a ϕ,θ,gain format with phi swept first. One can bring in data from an antenna chamber with the same function, as long as the data is evenly sampled.

To read from a CSV file in this format, a la HFSS:

`pattern = readHFSSPattern("Pattern.csv")`

```
32851-Element Radiation Pattern
Φ: 0.0 - 360.0 deg in 1.0 deg steps
θ: 0.0 - 90.0 deg in 1.0 deg steps
Min: -31.8846 dBi
Max: 10.3432 dBi
```

Notice that this will automatically calculate the range of the pattern in ϕ and θ and create the range objects for you.

### Plotting Radiation Patterns

We can plot these radiation patterns in 2D and 3D with the Plotly.js backend. These plots are fully interactive and the objects returned by these plot functions can be modified as typical PlotlyJS objects.

To plot a polar 2D plot, call the `plotPattern2D`

function with the pattern and a `ϕ`

to slice.

`plt = plotPattern2D(pattern,90)`

And to plot in 3D, call the `plotPattern3D`

function.

`plt = plotPattern3D(pattern,gainMin = -30)`