# perturb

Apply perturbations to tracking scenario

Since R2020b

## Syntax

``offsets = perturb(scene)``

## Description

example

````offsets = perturb(scene)` perturbs the baseline tracking scenario, `scene`, according to the perturbations defined on objects (such as trajectories, sensors, and platforms) in the `scene` and returns offset values. Use the `perturbations` function to define property perturbations on each object. ```

## Examples

collapse all

Create a tracking scenario and add a platform.

```scenario = trackingScenario; p = platform(scenario); ```

Add a trajectory to the platform.

```p.Trajectory = waypointTrajectory('Waypoints',... [30 -40 -3; 30 -20 -3; 20 -10 -3; 0 -10 -3; -10 -10 -3]*1e3, ... 'TimeOfArrival', [0; 100; 150; 350; 450], ... 'Course', [90;90;180;180;180]); ```

Plot the trajectory.

```tp = theaterPlot("XLimits",[-20 35]*1e3,"YLimits",[-45 -5]*1e3); trajPlotter1 = trajectoryPlotter(tp,'DisplayName','Original','Color','b'); plotTrajectory(trajPlotter1,{p.Trajectory.Waypoints});```

Define perturbations for the waypoints. The following defines perturbations on the first and last waypoints as uniform distributions.

```perturbations(p.Trajectory, "Waypoints", "Uniform",... [-2000 -2000 0; 0 0 0; 0 0 0; 0 0 0; -2000 -2000 0],... [+2000 +2000 0; 0 0 0; 0 0 0; 0 0 0; +2000 +2000 0]);```

Perturb the scenario and observe the changed waypoints of the platform.

```perturb(scenario); trajPlotter2 = trajectoryPlotter(tp,'DisplayName','Perturbed','Color','g'); plotTrajectory(trajPlotter2,{p.Trajectory.Waypoints})```

## Input Arguments

collapse all

Tracking scenario, specified as a `trackingScenario` object.

## Output Arguments

collapse all

Property offsets, returned as an array of structures. Each structure contains these fields:

Field NameDescription
`PlatformID`ID of the platform
`PeturbedObject`Perturbed object mounted on the platform
`Property`Name of perturbed property
`Offset`Offset values applied in the perturbation
`PerturbedValue`Property values after the perturbation

## Version History

Introduced in R2020b