# ctmeasjac

Jacobian of measurement function for constant turn-rate motion

## Syntax

``measurementjac = ctmeasjac(state)``
``measurementjac = ctmeasjac(state,frame)``
``measurementjac = ctmeasjac(state,frame,sensorpos)``
``measurementjac = ctmeasjac(state,frame,sensorpos,sensorvel)``
``measurementjac = ctmeasjac(state,frame,sensorpos,sensorvel,laxes)``
``measurementjac = ctmeasjac(state,measurementParameters)``

## Description

example

````measurementjac = ctmeasjac(state)` returns the measurement Jacobian, `measurementjac`, for a constant turn-rate Kalman filter motion model in rectangular coordinates. `state` specifies the current state of the track.```

example

````measurementjac = ctmeasjac(state,frame)` also specifies the measurement coordinate system, `frame`.```

example

````measurementjac = ctmeasjac(state,frame,sensorpos)` also specifies the sensor position, `sensorpos`.```
````measurementjac = ctmeasjac(state,frame,sensorpos,sensorvel)` also specifies the sensor velocity, `sensorvel`.```
````measurementjac = ctmeasjac(state,frame,sensorpos,sensorvel,laxes)` also specifies the local sensor axes orientation, `laxes`.```

example

````measurementjac = ctmeasjac(state,measurementParameters)` specifies the measurement parameters, `measurementParameters`.```

## Examples

collapse all

Define the state of an object in 2-D constant turn-rate motion. The state is the position and velocity in each dimension, and the turn rate. Construct the measurement Jacobian in rectangular coordinates.

```state = [1;10;2;20;5]; jacobian = ctmeasjac(state)```
```jacobian = 3×5 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 ```

Define the state of an object in 2-D constant turn-rate motion. The state is the position and velocity in each dimension, and the turn rate. Compute the measurement Jacobian with respect to spherical coordinates.

```state = [1;10;2;20;5]; measurementjac = ctmeasjac(state,'spherical')```
```measurementjac = 4×5 -22.9183 0 11.4592 0 0 0 0 0 0 0 0.4472 0 0.8944 0 0 0.0000 0.4472 0.0000 0.8944 0 ```

Define the state of an object in 2-D constant turn-rate motion. The state is the position and velocity in each dimension, and the turn rate. Compute the measurement Jacobian with respect to spherical coordinates centered at `[5;-20;0]`.

```state = [1;10;2;20;5]; sensorpos = [5;-20;0]; measurementjac = ctmeasjac(state,'spherical',sensorpos)```
```measurementjac = 4×5 -2.5210 0 -0.4584 0 0 0 0 0 0 0 -0.1789 0 0.9839 0 0 0.5903 -0.1789 0.1073 0.9839 0 ```

Define the state of an object in 2-D constant turn-rate motion. The state is the position and velocity in each dimension, and the turn rate. Compute the measurement Jacobian with respect to spherical coordinates centered at `[25;-40;0]`.

```state2d = [1;10;2;20;5]; sensorpos = [25,-40,0].'; frame = 'spherical'; sensorvel = [0;5;0]; laxes = eye(3); measurementjac = ctmeasjac(state2d,frame,sensorpos,sensorvel,laxes)```
```measurementjac = 4×5 -1.0284 0 -0.5876 0 0 0 0 0 0 0 -0.4961 0 0.8682 0 0 0.2894 -0.4961 0.1654 0.8682 0 ```

Put the measurement parameters in a structure and use the alternative syntax.

```measparm = struct('Frame',frame,'OriginPosition',sensorpos,'OriginVelocity',sensorvel, ... 'Orientation',laxes); measurementjac = ctmeasjac(state2d,measparm)```
```measurementjac = 4×5 -1.0284 0 -0.5876 0 0 0 0 0 0 0 -0.4961 0 0.8682 0 0 0.2894 -0.4961 0.1654 0.8682 0 ```

## Input Arguments

collapse all

State vector for a constant turn-rate motion model in two or three spatial dimensions, specified as a real-valued vector or matrix.

• When specified as a 5-element vector, the state vector describes 2-D motion in the x-y plane. You can specify the state vector as a row or column vector. The components of the state vector are `[x;vx;y;vy;omega]` where `x` represents the x-coordinate and `vx` represents the velocity in the x-direction. `y` represents the y-coordinate and `vy` represents the velocity in the y-direction. `omega` represents the turn rate.

When specified as a 5-by-N matrix, each column represents a different state vector N represents the number of states.

• When specified as a 7-element vector, the state vector describes 3-D motion. You can specify the state vector as a row or column vector. The components of the state vector are `[x;vx;y;vy;omega;z;vz]` where `x` represents the x-coordinate and `vx` represents the velocity in the x-direction. `y` represents the y-coordinate and `vy` represents the velocity in the y-direction. `omega` represents the turn rate. `z` represents the z-coordinate and `vz` represents the velocity in the z-direction.

When specified as a 7-by-N matrix, each column represents a different state vector. N represents the number of states.

Position coordinates are in meters. Velocity coordinates are in meters/second. Turn rate is in degrees/second.

Example: `[5;0.1;4;-0.2;0.01]`

Data Types: `double`

Measurement output frame, specified as `'rectangular'` or `'spherical'`. When the frame is `'rectangular'`, a measurement consists of x, y, and z Cartesian coordinates. When specified as `'spherical'`, a measurement consists of azimuth, elevation, range, and range rate.

Data Types: `char`

Sensor position with respect to the navigation frame, specified as a real-valued 3-by-1 column vector. Units are in meters.

Data Types: `double`

Sensor velocity with respect to the navigation frame, specified as a real-valued 3-by-1 column vector. Units are in m/s.

Data Types: `double`

Local sensor coordinate axes, specified as a 3-by-3 orthogonal matrix. Each column specifies the direction of the local x-, y-, and z-axes, respectively, with respect to the navigation frame. That is, the matrix is the rotation matrix from the global frame to the sensor frame.

Data Types: `double`

Measurement parameters, specified as a structure or an array of structures. The fields of the structure are:

FieldDescriptionExample
`Frame`

Frame used to report measurements, specified as one of these values:

• `'Rectangular'` — Detections are reported in rectangular coordinates.

• `'Spherical'` — Detections are reported in spherical coordinates.

`'spherical'`
`OriginPosition`Position offset of the origin of the frame relative to the parent frame, specified as an `[x y z]` real-valued vector.`[0 0 0]`
`OriginVelocity`Velocity offset of the origin of the frame relative to the parent frame, specified as a `[vx vy vz]` real-valued vector.`[0 0 0]`
`Orientation`Frame rotation matrix, specified as a 3-by-3 real-valued orthonormal matrix.`[1 0 0; 0 1 0; 0 0 1]`
`HasAzimuth`

Logical scalar indicating if azimuth is included in the measurement.

This field is not relevant when the `Frame` field is `'Spherical'`.

`1`
`HasElevation`Logical scalar indicating if elevation information is included in the measurement. For measurements reported in a rectangular frame, and if `HasElevation` is false, the reported measurements assume 0 degrees of elevation.`1`
`HasRange`

Logical scalar indicating if range is included in the measurement.

This field is not relevant when the `Frame` is `'Spherical'`.

`1`
`HasVelocity`Logical scalar indicating if the reported detections include velocity measurements. For a measurement reported in the rectangular frame, if `HasVelocity` is `false`, the measurements are reported as ```[x y z]```. If `HasVelocity` is `true`, the measurement is reported as `[x y z vx vy vz]`. For a measurement reported in the spherical frame, if `HasVelocity` is `true`, the measurement contains range-rate information.`1`
`IsParentToChild`Logical scalar indicating if `Orientation` performs a frame rotation from the parent coordinate frame to the child coordinate frame. When `IsParentToChild` is `false`, then `Orientation` performs a frame rotation from the child coordinate frame to the parent coordinate frame.`0`

If you only want to perform one coordinate transformation, such as a transformation from the body frame to the sensor frame, you only need to specify a measurement parameter structure. If you want to perform multiple coordinate transformations, you need to specify an array of measurement parameter structures. To learn how to perform multiple transformations, see the Convert Detections to objectDetection Format (Sensor Fusion and Tracking Toolbox) example.

Data Types: `struct`

## Output Arguments

collapse all

Measurement Jacobian, returned as a real-valued 3-by-5 or 4-by-5 matrix. The row dimension and interpretation depend on value of the `frame` argument.

FrameMeasurement Jacobian
`'rectangular'`Jacobian of the measurements `[x;y;z]` with respect to the state vector. The measurement vector is with respect to the local coordinate system. Coordinates are in meters.
`'spherical'`Jacobian of the measurement vector `[az;el;r;rr]` with respect to the state vector. Measurement vector components specify the azimuth angle, elevation angle, range, and range rate of the object with respect to the local sensor coordinate system. Angle units are in degrees. Range units are in meters and range rate units are in meters/second.

collapse all

### Azimuth and Elevation Angle Definitions

Define the azimuth and elevation angles used in the toolbox.

The azimuth angle of a vector is the angle between the x-axis and its orthogonal projection onto the xy plane. The angle is positive in going from the x axis toward the y axis. Azimuth angles lie between –180 and 180 degrees. The elevation angle is the angle between the vector and its orthogonal projection onto the xy-plane. The angle is positive when going toward the positive z-axis from the xy plane.

## Version History

Introduced in R2017a