# ctrvmeasjac

Jacobian of measurement function for constant turn-rate and velocity-magnitude motion model

*Since R2024b*

## Syntax

## Description

returns the Jacobian of the measurement function, `measurementjac`

= ctrvmeasjac(`state`

)`measurementjac`

, for a
state based on the constant turn-rate and velocity-magnitude motion model.
`state`

specifies the current state.

**Note**

`ctrvmeasjac`

represents velocity in the
*xy*-plane with velocity magnitude and direction. For the Jacobian of
measurement function for constant turn-rate and velocity-magnitude motion model using
Cartesian components, `Vx`

and `Vy`

, see `ctmeasjac`

.

also specifies the measurement coordinate system, `measurementjac`

= ctrvmeasjac(`state`

,`frame`

)`frame`

.

also specifies the sensor position, `measurementjac`

= ctrvmeasjac(`state`

,`frame`

,`sensorpos`

)`sensorpos`

.

also specifies the sensor velocity, `measurementjac`

= ctrvmeasjac(`state`

,`frame`

,`sensorpos`

,`sensorvel`

)`sensorvel`

.

specifies the measurement parameters, `measurementjac`

= ctrvmeasjac(`state`

,`measurementParameters`

)`measurementParameters`

.

## Examples

### Measurement Jacobian of Constant Turn-Rate and Velocity-Magnitude Motion in Rectangular Frame

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

state = [1;10;2;20;5]; jacobian = ctrvmeasjac(state)

`jacobian = `*3×5*
1 0 0 0 0
0 1 0 0 0
0 0 0 0 0

### Measurement Jacobian of Constant Turn-Rate and Velocity-Magnitude Motion in Spherical Frame

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

```
state = [1;10;2;20;5;1.5;0];
jacobian = ctrvmeasjac(state,'spherical')
```

`jacobian = `*4×7*
-5.6728 0.5673 0 0 0 0 0
-0.0828 -0.8283 0 0 0 5.5769 0
0.0984 0.9841 0 0 0 0.1476 0
0.1766 -0.0158 0.4291 0.0311 0 -0.0125 0.1476

### Measurement Jacobian of Constant Turn-Rate and Velocity-Magnitude Motion in Translated Spherical Frame

Define the state of an object in 2-D motion with constant turn rate and constant velocity magnitude. The state includes the position in each dimension, the velocity magnitude, the course direction, 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];
jabobian = ctrvmeasjac(state,'spherical',sensorpos)
```

`jabobian = `*4×5*
-1.8765 -0.2502 0 0 0
0 0 0 0 0
-0.1322 0.9912 0 0 0
0.0640 0.0085 0.2148 0.0341 0

### Measurement Jacobian of Constant Turn-Rate and Velocity-Magnitude Object Using Measurement Parameters

Define the state of an object in 2-D motion with constant turn-rate and constant velocity magnitude. The state includes the position in each dimension, the velocity magnitude, the course direction, and the turn rate. Compute the measurement Jacobian with respect to a sensor located at `[-1;-2;0]`

, moving at 2 m/s along the x-axis, and rotated by 90 degrees about the z-axis relative to the global frame.

```
state2d = [1;10;2;20;5];
frame = 'spherical';
sensorpos = [-1;-2;0];
sensorvel = [2;0;0];
laxes = [0 -1 0; 1 0 0; 0 0 1];
jacobian = ctrvmeasjac(state2d,frame,sensorpos,sensorvel,laxes)
```

`jacobian = `*4×5*
-4.6456 0.7743 0 0 0
0 0 0 0 0
0.1644 0.9864 0 0 0
-0.0188 0.0031 0.4919 0.0304 0

Put the measurement parameters in a structure and use the syntax with the `measurementParameters`

argument.

measparm = struct('Frame',frame,'OriginPosition',sensorpos, ... 'OriginVelocity',sensorvel,'Orientation',laxes); jacobian = ctrvmeasjac(state2d,measparm)

`jacobian = `*4×5*
-4.6456 0.7743 0 0 0
0 0 0 0 0
0.1644 0.9864 0 0 0
-0.0188 0.0031 0.4919 0.0304 0

## Input Arguments

`state`

— State vector

real-valued five-element row or column vector | real-valued seven-element row or column vector

State vector for a constant turn-rate motion model in 2-D or 3-D, specified as a real-valued vector.

When you specify the current state as a five-element vector, the state vector describes 2-D motion in the

*xy*-plane. You can specify the state vector as a row or column vector. The components of the state vector are`[x;y;s;theta;omega]`

, where`x`

and`y`

represent the*x*-coordinate and*y*-coordinate in meters.`s`

represents the velocity magnitude in meters/second.`theta`

represents the course direction in the*xy*-plane, counter-clockwise with respect to the*x*-axis, in degrees.`omega`

represents the turn-rate in degrees/second.

When you specify the current state as a seven-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;y;s;theta;omega;z;vz]`

, where`x`

and`y`

represent the*x*-coordinate and*y*-coordinate in meters.`s`

represents the velocity magnitude in meters/second.`theta`

represents the course direction in the*xy*-plane, counter-clockwise with respect to the*x*-axis, in degrees.`omega`

represents the turn-rate in degrees/second.`z`

represent the position in the vertical plane in meters.`vz`

represents velocity component in the vertical plane in meters/second.

**Example: **`[0;300;15;40;0.5]`

**Data Types: **`single`

| `double`

`frame`

— Frame to report measurements

`'rectangular'`

(default) | `'spherical'`

Frame to report measurements, specified as `'rectangular'`

or
`'spherical'`

. When you specify frame as
`'rectangular'`

, a measurement consists of *x*,
*y*, and *z* Cartesian coordinates. When you
specify frame as `'spherical'`

, a measurement consists of azimuth,
elevation, range, and range rate.

**Data Types: **`char`

| `string`

`sensorpos`

— Sensor position

`[0;0;0]`

(default) | real-valued 3-by-1 column vector

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

**Data Types: **`single`

| `double`

`sensorvel`

— Sensor velocity

`[0;0;0]`

(default) | real-valued 3-by-1 column vector

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: **`single`

| `double`

`laxes`

— Local sensor axes coordinates

`[1,0,0;0,1,0;0,0,1]`

(default) | 3-by-3 orthogonal matrix

Local sensor axes coordinates, 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. The
matrix is the rotation matrix from the global frame to the sensor frame.

**Data Types: **`single`

| `double`

`measurementParameters`

— Measurement parameters

structure | array of structures

Measurement parameters, specified as a structure or an array of structures. This table lists the fields in the structure.

Field | Description | Example |
---|---|---|

`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.
In Simulink, when you create an object detection Bus, specify
| `'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 | `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 | `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 want to perform only one coordinate transformation, such as a transformation from the body frame to the sensor frame, you must specify a measurement parameter structure. If you want to perform multiple coordinate transformations, you must specify an array of measurement parameter structures. To learn how to perform multiple transformations, see the Convert Detections to objectDetection Format example.

**Data Types: **`struct`

## Output Arguments

`measurementjac`

— Jacobian of measurement function

real-valued *M*-by-*N* matrix

Jacobian of the measurement function, returned as a real-valued *M*-by-*N* matrix. The function constructs the Jacobian from the partial derivatives of the measurement vector with respect to the input state. The form of the measurement vector depends on the syntax.

When you do not specify the

`measurementParameters`

argument and set the`frame`

argument to`'rectangular'`

, the function outputs measurement vectors in the format of`[x;y;z]`

.When you do not specify the

`measurementParameters`

argument and set the`frame`

argument to`'spherical'`

, the function outputs measurement vectors in the format of`[az;el;r;rr]`

.When you specify the

`measurementParameters`

argument and set the`frame`

field to`'rectangular'`

, the size of the measurement vector depends on the value of the`HasVelocity`

field in the`measurementParameters`

structure. The measurement vector includes the Cartesian position and velocity coordinates of the tracked object with respect to the ego vehicle coordinate system.**Rectangular Measurements**`HasVelocity`

=`'false'`

`[x;y;z]`

`HasVelocity`

=`'true'`

`[x;y;z;vx;vy;vz]`

Position units are in meters and velocity units are in m/s.

When you specify the

`measurementParameters`

argument and set the`frame`

field to`'spherical'`

, the size of the measurement vector depends on the value of the`HasVelocity`

,`HasRange`

, and`HasElevation`

fields in the`measurementParameters`

structure. The measurement vector includes the azimuth angle,*az*, elevation angle,*el*, range,*r*, and range rate,*rr*, of the object with respect to the local ego vehicle coordinate system. Positive values for range rate indicate that an object is moving away from the sensor.**Spherical Measurements**`HasRange`

=`'true'`

`HasRange`

=`'false'`

`HasElevation`

=`'false'`

`HasElevation`

=`'true'`

`HasElevation`

=`'false'`

`HasElevation`

=`'true'`

`HasVelocity`

=`'false'`

`[az;r]`

`[az;el;r]`

`[az]`

`[az;el]`

`HasVelocity`

=`'true'`

`[az;r;rr]`

`[az;el;r;rr]`

`[az]`

`[az;el]`

Angle units are in degrees, range units are in meters, and range rate units are in m/s.

## More About

### Azimuth and Elevation Angle Definitions

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 when 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.

## Extended Capabilities

### C/C++ Code Generation

Generate C and C++ code using MATLAB® Coder™.

## Version History

**Introduced in R2024b**

## See Also

### Functions

`ctrv`

|`ctrvjac`

|`ctrvmeas`

|`cvmeasjac`

|`cameasjac`

|`ctmeasjac`

|`singermeasjac`

|`initctrvekf`

|`initctrvukf`

### Objects

## 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)