# initcaukf

Create constant-acceleration unscented Kalman filter from detection report

## Syntax

``filter = initcaukf(detection)``

## Description

example

````filter = initcaukf(detection)` creates and initializes a constant-acceleration unscented Kalman `filter` from information contained in a `detection` report. For more information about the unscented Kalman filter, see `trackingUKF`.```

## Examples

collapse all

Create and initialize a 3-D constant-acceleration unscented Kalman filter object from an initial detection report.

Create the detection report from an initial 3-D measurement, (-200,-30,5), of the object position. Assume uncorrelated measurement noise.

```detection = objectDetection(0,[-200;-30;5],'MeasurementNoise',2.0*eye(3), ... 'SensorIndex',1,'ObjectClassID',1,'ObjectAttributes',{'Car',2});```

Create the new filter from the detection report and display the filter properties.

`filter = initcaukf(detection)`
```filter = trackingUKF with properties: State: [9x1 double] StateCovariance: [9x9 double] StateTransitionFcn: @constacc ProcessNoise: [3x3 double] HasAdditiveProcessNoise: 0 MeasurementFcn: @cameas MeasurementNoise: [3x3 double] HasAdditiveMeasurementNoise: 1 Alpha: 1.0000e-03 Beta: 2 Kappa: 0 ```

Show the state.

`filter.State`
```ans = 9×1 -200 0 0 -30 0 0 5 0 0 ```

Show the state covariance matrix.

`filter.StateCovariance`
```ans = 9×9 2.0000 0 0 0 0 0 0 0 0 0 100.0000 0 0 0 0 0 0 0 0 0 100.0000 0 0 0 0 0 0 0 0 0 2.0000 0 0 0 0 0 0 0 0 0 100.0000 0 0 0 0 0 0 0 0 0 100.0000 0 0 0 0 0 0 0 0 0 2.0000 0 0 0 0 0 0 0 0 0 100.0000 0 0 0 0 0 0 0 0 0 100.0000 ```

Initialize a 3D constant-acceleration unscented Kalman filter from an initial detection report made from a measurement in spherical coordinates. If you want to use spherical coordinates, then you must supply a measurement parameter structure as part of the detection report with the `Frame` field set to `'spherical'`. Set the azimuth angle of the target to $4{5}^{\circ }$, and the range to 1000 meters.

```frame = 'spherical'; sensorpos = [25,-40,-10].'; sensorvel = [0;5;0]; laxes = eye(3);```

Create the measurement structure. Set `'HasVelocity'` and `'HasElevation'` to `false`. Then, the measurement vector consists of azimuth angle and range.

```measparms = struct('Frame',frame,'OriginPosition',sensorpos, ... 'OriginVelocity',sensorvel,'Orientation',laxes,'HasVelocity',false, ... 'HasElevation',false); meas = [45;1000]; measnoise = diag([3.0,2.0].^2); detection = objectDetection(0,meas,'MeasurementNoise', ... measnoise,'MeasurementParameters',measparms)```
```detection = objectDetection with properties: Time: 0 Measurement: [2x1 double] MeasurementNoise: [2x2 double] SensorIndex: 1 ObjectClassID: 0 MeasurementParameters: [1x1 struct] ObjectAttributes: {} ```
`filter = initcaukf(detection);`

Display the state vector.

`disp(filter.State)`
``` 732.1068 0 0 667.1068 0 0 -10.0000 0 0 ```

## Input Arguments

collapse all

Detection report, specified as an `objectDetection` object.

Example: `detection = objectDetection(0,[1;4.5;3],'MeasurementNoise', [1.0 0 0; 0 2.0 0; 0 0 1.5])`

## Output Arguments

collapse all

Unscented Kalman filter, returned as a `trackingUKF` object.

## Algorithms

• The function computes the process noise matrix assuming a one-second time step and an acceleration rate standard deviation of 1 m/s3.

• You can use this function as the `FilterInitializationFcn` property of a `trackerGNN` or `trackerTOMHT` object.

## Extended Capabilities

### C/C++ Code GenerationGenerate C and C++ code using MATLAB® Coder™.

Introduced in R2018b