# perturb

Since R2021a

## Syntax

``offsets = perturb(scenario)``

## Description

example

````offsets = perturb(scenario)` perturbs the baseline radar scenario, `scenario`, and returns offset values. Use the `perturbations` function to define the perturbations on objects, such as trajectories, sensors, and platforms, in the scenario.```

## Examples

collapse all

```scenario = radarScenario; 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

Radar scenario, specified as a `radarScenario` 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
`PerturbedObject`Perturbed object mounted on the platform
`Property`Name of the perturbed property
`Offset`Offset values applied in the perturbation
`PerturbedValue`Property values after the perturbation

## Version History

Introduced in R2021a