# arrayfactor

Array factor of sensor arrays

## Description

## Examples

### Compute Array Factor of Unsteered ULA

Compute the array factor for an unsteered 8-element ULA operating at 100 MHz. Elements are placed 0.4 wavelengths apart.

freq = 100e6; c = physconst('LightSpeed'); lam = c/freq; pos = (0:7)*0.4; ang = -90:90; af = arrayfactor(pos,ang); plot(ang,mag2db(abs(af.'))) xlabel('Angle (deg)') ylabel('Array pattern (dB)') ylim([-30 20]) title('Array Factor of Unsteered Uniform Linear Array')

### Display Beam Patterns of Array Factor

Display the array beam patterns for an 8-element ULA with half-wavelength spacing. Steer the array to -30, 0, and 30 degrees.

Set the positions of the ULA elements.

pos = (0:7)*0.5;

Define the steering direction weights.

angsteer = [-30 0 30]; wsteer = steervec(pos,angsteer);

Compute the array factors for each steering direction for all angles.

ang = -90:90; af = arrayfactor(pos,ang,wsteer);

Plot the array factor for each steering direction.

plot(ang,mag2db(abs(af.'))) xlabel('Angle (deg)') ylabel('Beam pattern (dB)') ylim([-50 20]) legend('Steer to -30 deg','Steer to 0 deg','Steer to 30 deg')

## Input Arguments

`pos`

— Positions of array sensor elements

1-by-*N* real-valued vector | 2-by-*N* real-valued matrix | 3-by-*N* real-valued matrix

Positions of the elements of a sensor array specified as a 1-by-*N* vector, a
2-by-*N* matrix, or a 3-by-*N* matrix. In this
vector or matrix, *N* represents the number of elements of the array.
Each column of `pos`

represents the coordinates of an element. If
`pos`

is a 1-by-*N* vector, then it represents
the *y*-coordinate of the sensor elements of a line array. The
*x* and *z*-coordinates are assumed to be zero.
When `pos`

is a 2-by-*N* matrix, it represents the
*(y,z)*-coordinates of the sensor elements of a planar array. This
array is assumed to lie in the *yz*-plane. The
*x*-coordinates are assumed to be zero. When `pos`

is a 3-by-*N* matrix, then the array can have an arbitrary shape.
Sensor positions are in terms of signal wavelength.

**Example: **`[0,0,0; 0.1,0.4,0.3; 1,1,1]`

**Data Types: **`double`

`ang`

— Arrival directions of incoming signals

1-by-*M* real-valued vector | 2-by-*M* real-valued matrix

Arrival directions of incoming signals specified as a 1-by-*M* vector or a
2-by-*M* matrix, where *M* is the number of
incoming signals. If `ang`

is a 2-by-*M* matrix,
each column specifies the direction in azimuth and elevation of the incoming signal
`[az;el]`

. The azimuth angle must lie between –180° and
180° and the elevation angle must lie between –90° and 90°. The azimuth
angle is the angle between the *x*-axis and the projection of the
arrival direction vector onto the *xy* plane. It is positive when
measured from the *x*-axis toward the *y*-axis. The
elevation angle is the angle between the arrival direction vector and
*xy*-plane. It is positive when measured towards the
*z* axis. If `ang`

is a
1-by-*M* vector, then it represents a set of azimuth angles with
the elevation angles assumed to be zero. Angle units are specified in degrees.

**Example: **[45;0]

**Data Types: **`double`

`wts`

— Array weights

`ones(N,1)`

(default) | complex-valued *N*-by-1 vector | complex-valued *N*-by-*L* matrix

Array weights, specified as a complex-valued *N*-by-1 vector or
complex-valued *N*-by-*L* matrix. Each column of
`wts`

corresponds to a different set of weights for the array.
*L* is the number of weight sets.

**Data Types: **`double`

**Complex Number Support: **Yes

## Output Arguments

`af`

— Array factor of sensor array

1-by-*M* complex-valued vector | *L*-by-*M* complex-valued matrix

## References

[1] Van Trees, Harry L. *Detection, Estimation, and Modulation Theory. 4: Optimum Array
Processing*. Wiley, 2002.

[2] Johnson, Don H. and D. Dudgeon.
*Array Signal Processing*. Englewood Cliffs, NJ: Prentice Hall,
1993.

[3] Van Veen, B.D. and K. M. Buckley. “Beamforming: A versatile approach to spatial filtering”

## Version History

**Introduced in R2022a**

## See Also

## Open Example

You have a modified version of this example. Do you want to open this example with your edits?

## MATLAB Command

You clicked a link that corresponds to this MATLAB command:

Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.

# Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a web site from the following list:

## How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

### Americas

- América Latina (Español)
- Canada (English)
- United States (English)

### Europe

- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)

- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)