# patternFromAI

Reconstruct 3-D radiation pattern of antenna or array from two orthogonal pattern slices using artificial intelligence (AI) based methods

Since R2024a

## Syntax

``patternFromAI(magVertSlice, angleVertSlice, magHorizSlice, angleHorizSlice)``
``[p3D, vertAngleOut, horizAngleOut] = patternFromAI(___)``
``[___] = patternFromAI(___,Name=Value)``

## Description

``` NoteTo use the `patternFromAI` function, you need a license for the Deep Learning Toolbox™ in addition to the Antenna Toolbox™. `patternFromAI(magVertSlice, angleVertSlice, magHorizSlice, angleHorizSlice)` plots the approximate 3-D radiation pattern reconstructed from the magnitude and angle data of input orthogonal slices `vertslice` and `horizSlice`.```

example

````[p3D, vertAngleOut, horizAngleOut] = patternFromAI(___)` returns the reconstructed pattern as a matrix along with the vectors of the horizontal and vertical angle values in degrees. For the matrix `p3D`, the number of rows/columns correspond to the number of elements of `vertAngleOut` / `horizAngleOut`.```
````[___] = patternFromAI(___,Name=Value)` provides a way to specify customization and tuning options, such as the angle convention, additional minimum and maximum magnitudes for slice normalization, and pattern plot options using one or more Name-Value Arguments.```

## Examples

collapse all

This example shows how to reconstruct the 3-D radiation pattern of a dipole antenna operating at 70MHz from its two orthogonal slices.

Get 2-D Pattern Data of Dipole Antenna

Define the azimuth and elevation angle ranges. Get the azimuth pattern data at ${0}^{\circ }$ elevation. Visualize the azimuth pattern.

```az = 0:359; el = -180:179; pA = patternAzimuth(dipole,70e6,0,Azimuth=az); figure patternAzimuth(dipole,70e6,0,Azimuth=az);```

Get the elevation pattern data at ${0}^{\circ }$ azimuth. Visualize the elevation pattern.

```pE = patternElevation(dipole,70e6,0,Elevation=el); figure patternElevation(dipole,70e6,0,Elevation=el);```

Reconstruct 3-D Radiation Pattern of Dipole Antenna

Use `patternFromAI` function to reconstruct the 3-D radiation pattern. Visualize the 3-D pattern.

```theta = 90-el; phi = az; [p3D, vertAngleOut, horizAngleOut] = patternFromAI(pE,theta,pA,phi); figure patternFromAI(pE,theta,pA,phi);```

This example shows how to import 2-D pattern data from a `.pln` file and reconstruct the 3-D radiation pattern from it.

Import 2-D Pattern Data

Use the `msiread` function to read a `.pln` file and import its contents to the workspace. Extract the magnitude and angles data form the workspace variables.

```[Horizontal,Vertical] = msiread('Test_file_demo.pln'); pE = Vertical.Magnitude; el = Vertical.Elevation; pA = Horizontal.Magnitude; az = Horizontal.Azimuth;```

Plot the elevation cut.

```figure polarpattern(Vertical.Elevation,Vertical.Magnitude,TitleTop="Elevation Cut")```

Plot the azimuth cut.

```figure polarpattern(Horizontal.Azimuth,Horizontal.Magnitude,TitleTop="Azimuthal Cut")```

Reconstruct 3-D Pattern

Use the `"az-el"` angle convention to reconstruct the 3-D pattern from imported 2-D pattern magnitude and angle data.

```figure patternFromAI(pE,el,pA,az,AngleConvention="az-el")```

## Input Arguments

collapse all

2-D pattern slice magnitude data along vertical/elevation plane in dBi, specified as a real-valued vector of either 360 or 361 elements, sampled at 1 degree resolution.

Example: `[10.55 10.25 10 ... -2]`

Data Types: `double`

Vertical/elevation slice angles in degrees, specified as a real-valued integer vector of either 360 or 361 elements, at 1 degree spacing.

Example: `0:360`

Data Types: `double`

2-D pattern slice magnitude data along horizontal/azimuth plane in dBi, specified as a real-valued vector of either 360 or 361 elements, sampled at 1 degree resolution.

Example: `[10.55 10.25 10 ... -2]`

Data Types: `double`

Horizontal/azimuth slice angles in degrees, specified as a real-valued integer vector of either 360 or 361 elements, at 1 degree spacing.

Example: `0:360`

Data Types: `double`

### Name-Value Arguments

Specify optional pairs of arguments as `Name1=Value1,...,NameN=ValueN`, where `Name` is the argument name and `Value` is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: `AngleConvention="az-el"`

Angle convention used in the input angles `vertAngle` and `horizAngle` for reconstruction, specified as either `"phi-theta"` or `"az-el"`. The default angle convention is `"phi-theta"`. For more information on angle conventions, see Antenna Toolbox Coordinate System.

Example: `"az-el"`

Data Types: `string`

Magnitudes to normalize the slice data prior to network inference, specified as a 2-element vector with its first element as the minimum magnitude and second element as the maximum magnitude. By default, `patternFromAI` uses the minimum and maximum values in the slices. To specify only one element, assign the other as `-Inf` or `Inf` respectively.

Tip

If the minimum and/or maximum directivity values of the pattern are known but are absent from the input slice data, specify either one or both in the `MinMaxMagnitude` argument to increase the accuracy of the pattern reconstruction.

Example: `[10 50]`

Data Types: `double`

Plot visualization options, specified as a `PatternPlotOptions` object. Only the `Transparency` and `MagnitudeScale` properties of `PatternPlotOPtions` can be changed. The other two properties `SizeRatio` and `AntennaOffset` are ignored.

Example: ```PatternPlotOptions(Transparency=0.6, MagnitudeScale=[1 10])```

## Output Arguments

collapse all

3-D pattern magnitude data in dBi, returned as a 361-by-181 real matrix.

Data Types: `double`

Elevation angles in degrees, returned as a 181-by-1 real integer vector.

Data Types: `double`

Azimuth angles in degrees, returned as a 361-by-1 real integer vector.

Data Types: `double`

## Version History

Introduced in R2024a