%% Perturb Waypoint Trajectory
% Define a waypoint trajectory. By default, this trajectory contains two waypoints.

traj = waypointTrajectory

% Define perturbations on the Waypoints property and the TimeOfArrival property.

rng(2020);
perturbs1 = perturbations(traj,'Waypoints','Normal',1,1)
perturbs2 = perturbations(traj,'TimeOfArrival','Selection',{[0;1],[0;2]})

% Perturb the trajectory.

offsets = perturb(traj)

% The Waypoints property and  the TimeOfArrival property have changed.

traj.Waypoints
traj.TimeOfArrival

% Copyright 2020 The MathWorks, Inc.