# cvmeasmsc

Measurement based on constant velocity (CV) model in MSC frame

## Syntax

``measurement = cvmeasmsc(state)``
``measurement = cvmeasmsc(state,frame)``
``measurement = cvmeasmsc(state,frame,laxes)``
``measurement = cvmeasmsc(state,measurementParameters)``

## Description

````measurement = cvmeasmsc(state)` provides the angular measurement (azimuth and elevation) of the state in the sensor frame described by the `state`.Tracking filters require a definition of the `MeasurementFcn` property. The `cvmeasmsc` function can be used as the `MeasurementFcn`. To use this `MeasurementFcn` with `trackerGNN` and `trackerTOMHT`, you can use the `trackingMSCEKF` filter.```

example

````measurement = cvmeasmsc(state,frame)` provides the measurement in the frame specified. The allowed values for `frame` are `'rectangular'` and `'spherical'`.```
````measurement = cvmeasmsc(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 observer's Cartesian frame. The default for `laxes` is [`1 0 0;0 1 0;0 0 1`].```

example

````measurement = cvmeasmsc(state,measurementParameters)` specifies the measurement parameters as a scalar struct or an array of struct.```

## Examples

collapse all

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

Spherical Frame

Obtain the azimuth and elevation measurements from an MSC state.

```mscState = [0.5;0;0.3;0;1e-3;1e-2]; cvmeasmsc(mscState)```
```ans = 2×1 28.6479 17.1887 ```

Rectangular Frame

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

`cvmeasmsc(mscState,'rectangular')`
```ans = 3×1 838.3866 458.0127 295.5202 ```

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

`cvmeasmsc(mscState,struct('Frame','rectangular'))`
```ans = 3×1 838.3866 458.0127 295.5202 ```

## Input Arguments

collapse all

State that is defined relative to an observer in modified spherical coordinates, specified as a vector or a 2-D matrix. For example, if there is a constant velocity target state, xT, and a constant velocity observer state, xO, then the `state` is defined as xT - xO transformed in modified spherical coordinates.

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

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

• 3-D space –– State is equal to [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 input state is specified as a matrix, states must be concatenated along columns, where each column represents a state following the convention specified above. The output is a matrix with the same number of columns as the input, where each column represents the measurement from the corresponding state.

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 elements present in the measurement represent x, y, and z position of the target in the observer's Cartesian frame. If using the `'spherical'` frame, the two elements present in the measurement represent azimuth and elevation measurement of the target. If not specified, the function provides the measurements in `'spherical'` frame.

Direction of local x, y, and z axes in the scenario, specified as a 3-by-3 matrix. If not specified, `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-element vector –– When `HasElevation` is set to `false`, the vector contains azimuth as the only measurement.

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

• Three-element vector –– When the `frame` is set to `'rectangular'`, the function measures the position measurement from an MSC state.

## Extended Capabilities

### Functions

Introduced in R2018b