# cvmeasmscjac

Jacobian of measurement using constant velocity (CV) model in MSC frame

## Syntax

``jacobian = cvmeasmscjac(state)``
``jacobian = cvmeasmscjac(state,frame)``
``jacobian = cvmeasmscjac(state,frame,laxes)``
``jacobian = cvmeasmscjac(state,measurementParameters)``

## Description

````jacobian = cvmeasmscjac(state)` calculates the Jacobian with respect to angular measurement (azimuth and elevation) of the state in the sensor frame. The motion can be either in 2-D or 3-D space. If motion model is in 2-D space, values corresponding to elevation are assumed to be zero.The `trackingEKF` and `trackingMSCEKF` filters require a definition of the `MeasurementJacobianFcn` property. The `cvmeasmscjac` function can be used as the `MeasurementJacobianFcn`. To use this `MeasurementFcn` with `trackerGNN` and `trackerTOMHT`, you can use the `trackingMSCEKF` filter.```

example

````jacobian = cvmeasmscjac(state,frame)` provides the Jacobian measurement in the frame specified. The allowed values for frame are `'rectangular'` and `'spherical'`.```
````jacobian = cvmeasmscjac(state,frame,laxes)` specifies the axes of the sensor's coordinate system. The `laxes` input is a 3-by-3 matrix with each column specifying the direction of local x, y, and z axes in the sensor coordinate system. The default for `laxes` is [`1 0 0;0 1 0;0 0 1`].```

example

````jacobian = cvmeasmscjac(state,measurementParameters)` specifies the measurement parameters as a struct.```

## Examples

collapse all

Using the `cvmeasmscjac` function, you can obtain the jacobian of the state measurements in the spherical and the rectangular frames.

Spherical Frame

Obtain the Jacobian of the azimuth and elevation measurements from an MSC state.

```mscState = [0.5;0;0.3;0;1e-3;1e-2]; cvmeasmscjac(mscState)```
```ans = 2×6 57.2958 0 0 0 0 0 0 0 57.2958 0 0 0 ```

Rectangular Frame

Obtain the Jacobian of the position measurement from an MSC state. Specify the frame as a second input.

`cvmeasmscjac(mscState,'rectangular')`
```ans = 3×6 105 × -0.0046 0 -0.0026 0 -8.3839 0 0.0084 0 -0.0014 0 -4.5801 0 0 0 0.0096 0 -2.9552 0 ```

Alternatively, you can specify the frame using `measurementParameters`.

`cvmeasmscjac(mscState,struct('Frame','rectangular'))`
```ans = 3×6 105 × -0.0046 0 -0.0026 0 -8.3839 0 0.0084 0 -0.0014 0 -4.5801 0 0 0 0.0096 0 -2.9552 0 ```

## Input Arguments

collapse all

State that is defined relative to an observer in modified spherical coordinates, as a vector. For example, if there is a target state, xT, and an observer state, xO, the `state` used by the function is xT - xO.

The 2-D version of modified spherical coordinates (MSC) is also referred to as the modified polar coordinates (MPC). In the case of:

• 2-D space –– State equals [az azRate 1/r vr/r].

• 3-D space –– State equals [az omega el elRate 1/r vr/r].

The variables used in the convention are:

• az –– Azimuth angle (rad)

• el –– Elevation angle (rad)

• azRate –– Azimuth rate (rad/s)

• elRate –– Elevation rate (rad/s)

• omega –– azRate × cos(el) (rad/s)

• 1/r –– 1/range (1/m)

• vr/r –– range-rate/range or inverse time-to-go (1/s)

If the motion model is in 2-D space, values corresponding to elevation are assumed to be zero if elevation is requested as an output.

Data Types: `single` | `double`

Measurement frame, specified as `'spherical'` or `'rectangular'`. If using the `'rectangular'` frame, the three rows present in `jacobian` represent the Jacobian of the measurements with respect to x, y, and z position of the target in the sensor's Cartesian frame. If using the `'spherical'` frame, the two rows present in `jacobian` represent the Jacobian of the azimuth and elevation measurements of the target. If not specified, the function provides the Jacobian of the measurements in the `'spherical'` frame.

Direction of local x, y, and z axes in the scenario, specified as a 3-by-3 matrix. Each column of the matrix specifies the direction of the local x, y, and z axes in the sensor coordinate system. If not specified, the `laxes` is equal to ```[1 0 0;0 1 0;0 0 1]```.

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.`1`
`HasElevation`Logical scalar indicating if elevation 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.`1`
`HasVelocity`Logical scalar indicating if the reported detections include velocity measurements. For measurements reported in the rectangular frame, if `HasVelocity` is false, the measurements are reported as `[x y z]`. If `HasVelocity` is `true`, measurements are reported as `[x y z vx vy vz]`.`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 example.

Data Types: `struct`

## Output Arguments

collapse all

Target measurement in MSC frame, returned as a:

• One-row matrix –– When `HasElevation` is set to `false`.

• Two-row matrix –– When the `frame` is set to `'spherical'`, the function measures the azimuth and elevation measurements from a MSC state.

• Three-row matrix –– When the `frame` is set to `'rectangular'`, the function measures the position measurement from a MSC state.

## Extended Capabilities

### Functions

Introduced in R2018b