主要内容

Aero.trajectory.addEvent

Add named events to trajectory

Since R2026a

Description

Examples

collapse all

This example shows how to create a Bezier trajectory as a timetable and add an event named Event1.

Create a Bezier trajectory as a timetable object.

refBezier = Aero.trajectory.bezierTrajectory(InitialPosition = [0, 0], ...
   FinalPosition = [50, 50],InitialHeading = 2, ...
   Altitude=  0,Speed = 10,Units = "Metric (MKS)", ...
   OutputFormat = "timetable")
refBezier=10×7 timetable
         timestamps         WaypointIndex    xNorth(m)    yEast(m)    Speed(m/s)    Altitude(m)    Heading(rad)    LateralAcceleration(m/sq.s)
    ____________________    _____________    _________    ________    __________    ___________    ____________    ___________________________

    26-Feb-2026 14:57:34          1                 0           0         10             0                 2                 -2.6509          
    26-Feb-2026 14:57:35          2            -2.289      6.9676         10             0            1.7611                 -3.8865          
    26-Feb-2026 14:57:36          3           -2.6168      13.582         10             0            1.4698                 -4.7445          
    26-Feb-2026 14:57:36          4          -0.98356      19.844         10             0            1.1651                  -4.426          
    26-Feb-2026 14:57:37          5            2.6109      25.752         10             0           0.89719                 -3.2591          
    26-Feb-2026 14:57:38          6            8.1664      31.308         10             0           0.68859                 -2.1196          
    26-Feb-2026 14:57:39          7            15.683       36.51         10             0           0.53414                 -1.3361          
    26-Feb-2026 14:57:40          8            25.161       41.36         10             0           0.42021                -0.85535          
    26-Feb-2026 14:57:41          9              36.6      45.856         10             0           0.33475                -0.56546          
    26-Feb-2026 14:57:42         10                50          50         10             0           0.26916                -0.38726          

Add two areas of enabled events with 1 in the output.

refBezierWithEvent = Aero.trajectory.addEvent(refBezier, "Event1", ...
    StartPositionIndex = [1, 5],EndPositionIndex = [2, 7])
refBezierWithEvent=10×8 timetable
         timestamps         WaypointIndex    xNorth(m)    yEast(m)    Speed(m/s)    Altitude(m)    Heading(rad)    LateralAcceleration(m/sq.s)    Event1
    ____________________    _____________    _________    ________    __________    ___________    ____________    ___________________________    ______

    26-Feb-2026 14:57:34          1                 0           0         10             0                 2                 -2.6509                1   
    26-Feb-2026 14:57:35          2            -2.289      6.9676         10             0            1.7611                 -3.8865                1   
    26-Feb-2026 14:57:36          3           -2.6168      13.582         10             0            1.4698                 -4.7445                0   
    26-Feb-2026 14:57:36          4          -0.98356      19.844         10             0            1.1651                  -4.426                0   
    26-Feb-2026 14:57:37          5            2.6109      25.752         10             0           0.89719                 -3.2591                1   
    26-Feb-2026 14:57:38          6            8.1664      31.308         10             0           0.68859                 -2.1196                1   
    26-Feb-2026 14:57:39          7            15.683       36.51         10             0           0.53414                 -1.3361                1   
    26-Feb-2026 14:57:40          8            25.161       41.36         10             0           0.42021                -0.85535                0   
    26-Feb-2026 14:57:41          9              36.6      45.856         10             0           0.33475                -0.56546                0   
    26-Feb-2026 14:57:42         10                50          50         10             0           0.26916                -0.38726                0   

Input Arguments

collapse all

Trajectory data, specified as a timetable or timeseries. Use a trajectory function to generate the trajectory data.

Example: trajectoryData = refBezier

Event name to be added, specified as a scalar string.

Example: eventName = Event1

Data Types: string

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: StartPositionIndex = [1, 3]

Time at which event starts, specified as a datetime object.

Example: StartTime=datetime('now')

Dependencies

Specify only the pairs StartTime and EndTime or StartPositionIndex and EndPositionIndex. Do not specify both pairs.

Time at which event ends, specified as a datetime object.

Example: EndTime=datetime('tomorrow')

Dependencies

Specify only the pairs StartTime and EndTime or StartPositionIndex and EndPositionIndex. Do not specify both pairs.

Waypoint index at which event starts, specified as a 1-by-2 array of positive integers.

Example: StartPositionIndex = [1, 3]

Dependencies

Specify only the pairs StartTime and EndTime or StartPositionIndex and EndPositionIndex. Do not specify both pairs.

Waypoint index at which event ends, specified as a 1-by-2 array of positive integers.

Example: EndPositionIndex = [2,6]

Dependencies

Specify only the pairs StartTime and EndTime or StartPositionIndex and EndPositionIndex. Do not specify both pairs.

Output Arguments

collapse all

Trajectory with event, returned as a timetable or timeseries.

Version History

Introduced in R2026a