# EHfields

Electric and magnetic fields of antennas or embedded electric and magnetic fields of antenna element in arrays

## Syntax

``````[e,h] = EHfields(object,frequency)``````
``EHfields(object,frequency)``
``````[e,h] = EHfields(object,frequency,points)``````
``EHfields(object, frequency, points)``
``EHfields(___,Name=Value)``

## Description

``````[e,h] = EHfields(object,frequency)``` calculates the x, y, and z components of the electric and magnetic fields of an antenna or array object at a specified frequency. The fields are calculated at points on the surface of a sphere whose radius is twice that of the radius of a sphere completely enclosing the antenna or array structure. ```

example

````EHfields(object,frequency)` plots the absolute values of the electric and magnetic field vectors along with corresponding signed complex angles at the specified frequency. The multiplication factor with absolute field value is +1 for positive and -1 for negative complex angle. The fields are calculated at points on the surface of a sphere whose radius is twice that of the radius of a sphere completely enclosing the antenna or array structure.```

example

``````[e,h] = EHfields(object,frequency,points)``` calculates the x, y, and z components of electric field and magnetic field of an antenna or array object. These fields are calculated at specified points in the space and at a specified frequency. Specify the points in the Cartesian coordinate system.```

example

````EHfields(object, frequency, points)` plots the absolute values of the electric and magnetic field vectors along with corresponding signed complex angles at specified frequency values and at specified points in space. The multiplication factor with absolute field value is +1 for positive and -1 for negative complex angle. Specify the points in the Cartesian coordinate system.```
````EHfields(___,Name=Value)` plots the electric and magnetic field vectors using one or more name-value arguments in addition to any of the input argument combinations in previous syntaxes. For example, `ViewField="E"` displays only the electric field.Use the `ElementNumber` and `Termination` properties to calculate the embedded electric and magnetic fields of the antenna element in an array connected to a voltage source. The voltage source model consists of an ideal voltage source of 1 volt. The embedded pattern includes the effect of mutual coupling due to the other antenna elements in the array.```

## Examples

collapse all

Plot electric and magnetic fields of a default Archimedean spiral antenna.

```h = spiralArchimedean; EHfields(h,4e9)```

Calculate electric and magnetic fields at a point 1m along the z-axis from an Archimedean spiral antenna.

```h = spiralArchimedean; [e,h] = EHfields(h,4e9,[0;0;1])```
```e = 3×1 complex 0.4154 + 0.2561i 0.3058 - 0.4089i -0.0000 + 0.0000i ```
```h = 3×1 complex -0.0008 + 0.0011i 0.0011 + 0.0007i 0.0000 - 0.0000i ```

Calculate electric and magnetic fields at a point 1 m along the z-axis from an Archimedean spiral antenna. Return the field as azimuth, elevation, and radius values in a spherical coordinate system.

```h = spiralArchimedean; [e,h] = EHfields(h,4e9,[0 0 1]',CoordinateSystem="spherical")```
```e = 3×1 complex 0.3058 - 0.4089i -0.4154 - 0.2561i -0.0000 + 0.0000i ```
```h = 3×1 complex 0.0011 + 0.0007i 0.0008 - 0.0011i 0.0000 - 0.0000i ```

Create an Archimedean spiral antenna. Plot electric and magnetic field vector at the z = 1cm plane from the antenna.

`h = spiralArchimedean;`

Define points on a rectangular grid in the X-Y plane.

`[X,Y] = meshgrid(-.05:.01:.05,-.05:.01:.05);`

Add a z-offset of 0.01.

`p = [X(:)';Y(:)';.01*ones(1,prod(size(X)))];`

Plot electric and magnetic field vector at the z = 1cm plane. from the antenna

`EHfields (h,4e9,p)`

Plot the embedded vector fields of a linear array when the first element is excited and all the other antenna elements are terminated using 50-ohm resistance.

```l = linearArray; EHfields(l, 70e6, ElementNumber=1, Termination=50);```

Calculate electric and magnetic fields of a dipole antenna.

`[E H] = EHfields(dipole, 70e6:2e6:80e6, [0 0 0]')`
```E = 3×6 complex 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i 0.0000 - 0.0000i -0.0724 + 0.0465i -0.0664 + 0.0396i -0.0645 + 0.0324i -0.0652 + 0.0265i -0.0671 + 0.0219i -0.0696 + 0.0185i -1.5528 - 1.9717i -1.8722 - 1.6858i -2.0207 - 1.3868i -2.0627 - 1.1350i -2.0502 - 0.9389i -2.0130 - 0.7895i ```
```H = 3×6 complex 10-7 × -0.0339 + 0.0071i -0.0718 + 0.0279i -0.0952 + 0.0541i -0.1081 + 0.0788i -0.1150 + 0.1000i -0.1186 + 0.1175i 0.0231 - 0.0030i 0.0547 - 0.0188i 0.0745 - 0.0395i 0.0856 - 0.0591i 0.0916 - 0.0760i 0.0948 - 0.0901i -0.0001 - 0.0000i -0.0001 - 0.0000i -0.0002 - 0.0000i -0.0002 - 0.0000i -0.0002 - 0.0001i -0.0003 - 0.0001i ```

Calculate the electric and magnetic fields of a helix antenna with a vertically polarized electric field.

`EHfields(helix, 1e9, Polarization="V")`
```ans = 1×441 complex 0.0262 - 0.0331i -0.0327 + 0.0491i -0.0403 + 0.0626i -0.0497 + 0.0733i -0.0616 + 0.0808i -0.0762 + 0.0847i -0.0938 + 0.0839i -0.1141 + 0.0774i -0.1362 + 0.0638i -0.1581 + 0.0419i -0.1769 + 0.0112i -0.1889 - 0.0274i -0.1904 - 0.0711i -0.1787 - 0.1152i -0.1535 - 0.1537i -0.1171 - 0.1808i -0.0749 - 0.1922i -0.0333 - 0.1860i 0.0015 - 0.1635i 0.0262 - 0.1288i -0.0415 + 0.0869i 0.0262 - 0.0331i 0.0082 + 0.0459i -0.0012 + 0.0618i -0.0141 + 0.0762i -0.0309 + 0.0881i -0.0519 + 0.0962i -0.0770 + 0.0989i -0.1051 + 0.0945i -0.1344 + 0.0814i -0.1621 + 0.0588i -0.1843 + 0.0271i -0.1970 - 0.0113i -0.1969 - 0.0521i -0.1826 - 0.0896i -0.1555 - 0.1174i -0.1196 - 0.1303i -0.0811 - 0.1256i -0.0465 - 0.1039i -0.0203 - 0.0686i -0.0031 - 0.0252i -0.0415 + 0.0869i 0.0262 - 0.0331i 0.0477 + 0.0399i 0.0366 + 0.0583i 0.0207 + 0.0766i -0.0007 + 0.0931i -0.0276 + 0.1059i -0.0596 + 0.1126i -0.0952 + 0.1109i ```

## Input Arguments

collapse all

Antenna or array to calculate the field magnitudes, specified as an antenna or array from the catalog, a `pcbStack` object or custom antenna or array created using either of these:

Example: `spiralArchimedean`

Frequency or frequency range over which to calculate electric and magnetic fields, specified as a scalar or a vector in Hz.

Example: 70e6

Data Types: `double`

Cartesian coordinates of points in space, specified as a 3-by-p matrix. p is the number of points at which to calculate the `E-H` field.

Example: `[0 0 1]'`

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: `ScaleFields=[2 0.5]` specifies scalar values of the electric and magnetic fields

Before R2021a, use commas to separate each name and value, and enclose `Name` in quotes.

Example: `'ScaleFields',[2 0.5]` specifies scalar values of the electric and magnetic fields

Value by which to scale the electric and magnetic fields, specified as a two-element vector. The first element scales the E field and the second element scales the H-field. A value of `2` doubles the relative length of either field. A value of `0.5` to halves the length of either field. A value of `0` plots either field without automatic scaling.

Example: `ScaleFields=[2 0.5]`

Data Types: `double`

Field to display, specified as either `"E"` or `"H"`. `"E"` displays the electric field and `"H"` displays the magnetic field.

Example: `ViewField="E"`

Data Types: `string`

Antenna element in array represented by its position number, specified as a scalar. This antenna element is connected to the voltage source. Use this property to calculate the embedded pattern of an array.

Example: `ElementNumber=1`

Data Types: `double`

Impedance value for array element termination, specified as a scalar in ohms. The impedance value terminates other antenna elements of an array while calculating the embedded pattern of the antenna connected to the voltage source. Use this property to calculate the embedded pattern of an array.

Example: `Termination=40`

Data Types: `double`

Coordinate system to calculate the electric and magnetic fields of an antenna or array, specified as either `"rectangular"` or `"spherical"`.

When you specify both the `CoordinateSystem` and the `Polarization` name-value arguments, the `EHfields` function ignores the value of `CoordinateSystem`. The output is the same in both coordinate systems.

Example: `CoordinateSystem="spherical"`

Data Types: `string`

Polarization of the electric field, specified as either `"H"` for horizontal polarization or `"V"` for vertical polarization or `"combined"` for mixed horizontal and vertical polarization. The default value is set to `"combined"`. The magnetic field has the opposite polarization.

When you specify `Polarization` in a syntax without output arguments, the `EHfields` function returns the component of the electric field with polarization as a 1-by-p vector in the variable `ans`. The function does not plot the values when the polarization is set to either `"H"` or `"V"`.

For the spherical `CoordinateSystem`, when the polarization is vertical, the E-field is the elevation component and H-field is the azimuth component. And when the polarization is horizontal, the E-field is the azimuth component and H-field is the elevation component.

Example: `Polarization="H"`

Data Types: `string`

## Output Arguments

collapse all

x, y, z components of electrical field in the rectangular coordinate system or `azimuth`, `elevation`, `radial` components in the spherical coordinate system, returned as 3-by-p complex matrix in V/m. The dimension p is the number of points in space at which the electric and magnetic fields are computed.

x, y, z components of magnetic field in the rectangular coordinate system or `azimuth`, `elevation`, `radial` components in the spherical coordinate system, returned as a 3-by-p complex matrix in A/m. The dimension p is the number of points in space at which the electric and magnetic fields are computed.

## Version History

Introduced in R2015a