# Documentation

## Global and Local Coordinate Systems

### Global Coordinate System

As the word global indicates, the global coordinate system describes the entire environment that you want to model. Within this global coordinate system, you can have several phased array systems, both stationary and mobile. You can also have a number of stationary and mobile targets. Additionally, there are usually stationary and mobile environmental features that produce spurious signals you want to ignore as well as stationary and mobile sources that are actively attempting to interfere with your phased arrays (jammers).

To extract useful information from this environment, you often need to analyze data from multiple phased arrays over time. Each phased array senses the environment from its own local perspective. To put the information from each phased array into a global perspective, you must know the location of each array in the global coordinate system and the orientation of the array's coordinate axes.

In the following figure, the solid dark axes denote the coordinate axes of a global coordinate system. There are two phased arrays, Array 1, and Array 2. Each of the phased arrays defines its own coordinate system within the global system denoted by the dashed lines. A target is indicated by the black circle.

The two phased arrays detect the target and estimate target characteristics such as range and velocity. To translate information about the target derived from the two spatially-separated phased arrays, you must know the positions of the phased arrays and the orientation of their local coordinate axes with respect to the global coordinate system.

 Note:   In specifying a global coordinate system, you can designate any point as the origin. The coordinate axes must be orthogonal.

### Local Coordinate System

Local coordinate systems are defined by phased arrays located within the global coordinate system. The coordinate axes of a local coordinate system must be orthogonal, but they do not need to be parallel to the global coordinate axes. The local origin may be located anywhere in the global coordinate system and need not be stationary. For example, a vehicle-mounted phased array has its own local coordinate system, which moves within the global coordinate system.

You can specify target locations with respect to a local coordinate system in terms of range and direction of arrival. A target's range corresponds to R, the Euclidean distance in spherical coordinates. The direction of arrival corresponds to the azimuth and elevation angles. Phased Array System Toolbox™ software follows the MATLAB® convention and lists spherical coordinates in the order: (az,el,R).

The positions of all array elements in this software are in local coordinates. The following examples illustrate local coordinate systems for uniform linear, uniform rectangular, and conformal arrays.

#### Local Coordinate System for a Uniform Linear Array

For a uniform linear array (ULA), the origin of the local coordinate system is the phase center of the array. The positive x-axis is the direction normal to the array, and the elements of the array are located along the y-axis. The y-axis is referred to as the array axis. Define the axis normal to the array as the span of the vector [1 0 0] and the array axis as the span of the vector [0 1 0]. The z-axis is the span of the vector [0 0 1], which is the cross product of the two vectors: [1 0 0] and [0 1 0].

Construct a uniform linear array:

H = phased.ULA('NumElements',2,'ElementSpacing',0.5)
getElementPosition(H)

The following figure illustrates the default ULA in a local right-handed coordinate system:

The elements are located 0.25 meters from the phase center of the array and the distance between the two elements is 0.5 meters.

Construct a ULA with eight elements spaced 0.25 meters apart:

H = phased.ULA('NumElements',8,'ElementSpacing',0.25)
% Invoke the getElementPosition method
% to see the local coordinates of the elements
getElementPosition(H)

#### Local Coordinate System of a Uniform Rectangular Array

In a uniform rectangular array (URA), the origin of the local coordinate system is the phase center of the array. The x-axis is the direction normal to the array. In the yz plane, the array elements have even row spacing and even column spacing.

Construct a URA:

H = phased.URA('Size',[2 2],'ElementSpacing',[0.5 0.5])
ElementLocs = getElementPosition(H)

The following figure illustrates the default URA:

Construct a uniform rectangular array with two elements along the y-axis and three elements along the z-axis.

Ha = phased.URA([2 3])
ElementLocs2by3 = getElementPosition(Ha)

#### Local Coordinate System of a Conformal Array

In a conformal array, the phase center of the array may be defined at an arbitrary point. In principle, the orientation of each element in a conformal array may be different. Therefore, it is convenient to define the array by giving the element locations with respect to the local coordinate system origin along with the azimuth and elevation angles defining the boresight directions.

Construct a default conformal array:

H = phased.ConformalArray
% query element position and element normal
H.ElementPosition
H.ElementNormal

The default conformal array consists of a single element located at [0 0 0], the origin of the local coordinate system. The boresight direction of the single element is specified by the azimuth and elevation angles (in degrees) in the ElementNormal property, [0 0].

Construct a conformal array with three elements located at [1 0 0], [0 1 0], and [0 –1 0] with respect to the origin. Define the normal direction to the first element as 0 degrees azimuth and elevation. Define the normal direction to the second and third elements as 45 degrees azimuth and elevation.

H = phased.ConformalArray(...
'ElementPosition',[1 0 0; 0 1 0; 0 -1 0]',...
'ElementNormal',[0 45 45; 0 45 45])

### Converting Between Global and Local Coordinate Systems

In many array processing applications, it is necessary to convert between global and local coordinates. Two utility functions, global2localcoord and local2globalcoord, enable you to do this conversion.

Convert Local Spherical Coordinates to Global Rectangular Coordinates

Assume a stationary target 1000 meters from a URA at an azimuth angle of 30 degrees and elevation angle of 45 degrees. The phase center of the URA is located at the rectangular coordinates [1000 500 100] in the global coordinate system. The local coordinate axes of the URA are parallel to the global coordinate axes. Determine the position of the target in rectangular coordinates in the global coordinate system.

In this example, the target's location is specified in local spherical coordinates. The target is 1000 meters from the array, which means that R=1000.The azimuth angle of 30 degrees and elevation angle of 45 degrees give the direction of the target from the array. The spherical coordinates of the target in the local coordinate system are (30,45,1000). To convert to global rectangular coordinates, you must know the position of the array in global coordinates. The phase center of the array is located at [1000 500 100]. To convert from local spherical coordinates to global rectangular coordinates, use the 'sr' option.

gCoord = local2globalcoord([30; 45; 1000],'sr',...
[1000; 500; 100]);

Convert Global Rectangular Coordinates to Local Spherical Coordinates

Assume a stationary target with global rectangular coordinates [5000 3000 50]. The phase center of a URA has global rectangular coordinates [1000 500 10]. The local coordinate axes of the URA are [0 1 0], [1 0 0], and [0 0 –1]. Determine the position of the target in local spherical coordinates.

lCoord = global2localcoord([5000; 3000; 50],'rs',...
[1000; 500; 10],[0 1 0;1 0 0;0 0 -1]);

The output lCoord is in the form (az,el,R). The target in local coordinates has an azimuth of approximately 58 degrees, an elevation of 0.5 degrees, and a range of 4717.16 m.