主要内容

Generate Trajectory

Generate reference signals for standard trajectories in Live Editor

Since R2026a

Description

The Generate Trajectory task enables you to interactively create standard trajectories using three different unit systems, generate corresponding reference signals, and add events to the generated trajectory.

You can specify the trajectory start time and choose to output the data in either timeseries or timetable format.

The task automatically generates MATLAB® code, allowing for further modification and integration into your workflow.

For general information about Live Editor tasks, see Add Interactive Tasks to a Live Script.

By default, the live task creates a workspace variable, Vehicle1Trajectory.

Generate Trajectory task in Live Editor

Open the Task

To add the Generate Trajectory task to a live script in the MATLAB Editor:

  • On the Live Editor tab, select Task > Generate Trajectory.

  • In a code block in the script, type a relevant keyword, such as generate or trajectory. From the selected completions, select Generate Trajectory.

The Generate Trajectory option is shown in the list of completions

Examples

expand all

This example shows how to use the Generate Trajectory Live Editor task to create reference signals for a bezier trajectory. By default, Generate Trajectory creates a variable named Vehicle1Traj in the workspace that outputs data in the timeseries format.

From Select trajectory type, select Bezier.

In Vehicle parameters section, set Initial position to [10 0].

In Path parameters section, set the Shape factor to 1.

The live task prepopulates with default values.

In the Display results section, click 3D Plot.

To the upper right, a plot of the waveform displays.

Bezier trajectory plot

To see the code that this task generates, expand the task display by clicking Show code button at the bottom of the task parameter area.

Generated code for Bezier trajectory

You can use the data from the Vehicle1Trajectory timeseries object in many cases where you want to input data, for example, to import to Signal Editor for modeling trajectories. To save this task, save the live script.

This example shows how to use the Generate Trajectory Live Editor task to create reference signals for a bezier trajectory. By default, Generate Trajectory creates a variable named Vehicle1Traj in the workspace that outputs data in the timeseries format.

From the Select trajectory type, select Bezier.

In the Vehicle parameters section, set Initial position to [10 0].

In the Path parameters section, set the Shape factor to 2.

Leave the other parameters at their default values.

From the MATLAB Command Window, create a model and add a Signal Editor block.

In the Signal Editor block, click the Open Signal Editor button. The Signal Editor tool opens.

In the Signal Editor tool, on the Signal Editor tab, click Import.

In the Import dialog box, under Select signals to import, select Vehicle1Traj, and then click OK.

In the Signal Editor, drag the Vehicle1Traj bus to the active Scenario.

Vehicle1Traj reference signals added to Signal Editor tool

Save the updates to a new MAT file, such as C:\work\veh1traj.mat. Close the Signal Editor tool.

In the Signal Editor block, set File name to the name of the new MAT file.

Use the output signals from the Signal Editor block in your aerospace application.

Related Examples

Parameters

expand all

Specify properties for each vehicle.

Type of trajectory, specified as Sector search, Expanding square search, Trackline search, Parallel sweep search, Creeping line search, Polyline, Bezier, Circular, or Polynomial.

Trajectory TypeDescription

Sector search

Generate reference signals for a sector search trajectory

Expanding square search

Generate reference signals for an expanding square search pattern.

Trackline search

Generate reference signals for trackline search patterns.

Trackline trajectory with return:

Trackline trajectory with no return:

Parallel sweep search

Generate reference signals for a parallel sweep search trajectory.

Creeping line search

Generate trajectory reference signals for a creeping line search pattern.

Polyline

Generate trajectory reference signals for a polyline flight trajectory.

Bezier

Generate reference signals for tracing Bezier trajectories.

Circular

Generate reference signals for tracing a trajectory that consists of multiple circular arcs.

Polynomial

Generates reference signals for tracing a polynomial trajectory.

Coordinate system configuration

Input and output units, specified as one of these values:

Units

Position

Altitude

Speed

Metric (MKS)

Meters

Meters

Meters per second

English (Velocity in ft/s)

Feet

Feet

Feet per second

English (Velocity in kts)

Nautical miles

Feet

Knots

Coordinate plane of trajectory, specified as Flat, Spherical, or Ellipsoidal.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Vehicle parameters

Initial position of trajectory, specified as a 1-by-2 or 2-by-1 vector in the units specified in Units.

Data Types: double

Final position of trajectory, specified as a 1-by-2 or 2-by-1 vector in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

Data Types: double

Initial heading of trajectory, specified as a finite real double scalar between 0 and 2*pi, in radians.

Dependencies

When Select trajectory type is set to Bezier, Circular, or Polynomial, Initial heading default is pi/2. For all other trajectory types, default is 0.

Data Types: double

Final heading of trajectory, specified as a finite real double scalar between 0 and 2*pi, in radians.

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

Data Types: double

Initial altitude of trajectory, specified as a scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Sector search, Expanding square search, Trackline search, Parallel sweep search, Creeping line search, or Polyline.

Data Types: double

Initial speed of trajectory, specified as a finite real double scalar in the units specified in Units.

Data Types: double

Path parameters

Shape factor constant, specified as a scalar or 2-element vector, depending on the trajectory type. The shape factor constant ShapeFactor provides additional control over the trajectory, with its effect depending on the specific trajectory type. For more information on shape factors according to trajectory type, see:

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

  • When Select trajectory type is set to Circular, Shape factor default is 0. The value must be a nonnegative scalar and between 0 and 1.

  • When Select trajectory type is set to Bezier, default is 1. The value must be a positive scalar between 0 and 10 or a 2-element vector.

  • When Select trajectory type is set to Polynomial, default is 1. The value must be a positive scalar between 0 and 10.

Data Types: double

Altitude of trajectory, specified as a finite real scalar double in the units specified in Units. This value is constant throughout the vehicle path.

Dependencies

The default value depends on the trajectory type:

  • If Select trajectory type is set to Sector search, Expanding square search, Trackline search, Parallel sweep search, or Creeping line search, the default value is 100

  • If Select trajectory type is set to Bezier, Circular, Polynomial, or Polyline the default value is 0

Data Types: double

Number of samples in the output signals, specified as a scalar.

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

Data Types: double

Radius of trajectory, specified as a positive scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Sector search.

Data Types: double

Bearing, specified as a finite real scalar double between 0 and 2*pi, in radians.

Dependencies

To enable this parameter, set Select trajectory type to Sector search, Expanding square search, Parallel sweep search, or Creeping line search.

Data Types: double

Number of legs in the expanding square, specified as a nonnegative integer in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Expanding square search.

Data Types: double

Spacing between tracks, specified as a scalar.

Dependencies

To enable this parameter, set Select trajectory type to Creeping line search, Expanding square search, Trackline search, or Parallel sweep search.

The default value depends on the trajectory type:

  • If Select trajectory type is set to Parallel sweep search or Creeping line search, the default value is 1.

  • If Select trajectory type is set to Expanding square search, the default value is 3.

  • If Select trajectory type is set to Trackline search, the default value is 5.

Data Types: double

Trackline search type, specified as Return (TSR) or No return (TSN).

Dependencies

To enable this parameter, set Select trajectory type to Trackline search.

Data Types: char | string

First track point, specified as a 1-by-2 or 2-by-1 vector as finite real doubles in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Trackline search.

Data Types: double

Second track point, specified as a 1-by-2 or 2-by-1 vector as finite real doubles in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Trackline search.

Data Types: double

Field length, specified as a scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Parallel sweep search.

Data Types: double

Field width, specified as a positive scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Parallel sweep search or Creeping line search.

Data Types: double

Field center, specified as a 1-by-2 or 2-by-1 vector of finite real doubles in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Parallel sweep search or Creeping line search.

Data Types: double

Current position of vehicle, specified as a 1-by-2 or 2-by-1 vector finite real doubles.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Data Types: double

Current heading of vehicle, specified between 0 and 2*pi as a scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Data Types: double

Segment distance in a trajectory, specified as a positive scalar in the units specified in Units.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Data Types: double

Absolute bearing, specified as a scalar between 0 and 2*pi, in the units specified in Units. This value is the angle measured clockwise from true north to the direction of travel along the trajectory. Specify either AbsoluteBearing or RelativeBearing. Do not specify both properties.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Data Types: double

Relative bearing, specified as a scalar between 0 and 2*pi, in the units specified in Units. This value is the angle measured clockwise from true north to the direction of travel along the trajectory. Specify either AbsoluteBearing or RelativeBearing. Do not specify both properties.

Dependencies

To enable this parameter, set Select trajectory type to Polyline.

Data Types: double

Minimum turn radius limit, specified as a finite real double scalar in the units specified in Units. Minimum turn radius must be less than or equal to Maximum turn radius.

Dependencies

To enable this parameter, set Select trajectory type to Circular.

Data Types: double

Maximum turn radius limit, specified as a positive real double scalar in the units specified in Units. Maximum turn radius must be greater than or equal to Minimum turn radius.

Dependencies

To enable this parameter, set Select trajectory type to Circular.

Data Types: double

Vehicle coordination mode, specified as 1-1 Coordination, 1-2 v, or 1-3 Coordination.

Dependencies

To enable this parameter, set Select trajectory type to Creeping line search.

Search direction, specified as Counterclockwise or Clockwise.

Dependencies

To enable this parameter, set Select trajectory type to Sector search or Expanding square search.

The default value depends on the trajectory type:

  • If Select trajectory type is set to Sector search, the default value is Counterclockwise.

  • If Select trajectory type is set to Expanding square search, the default value is Clockwise.

Trajectory data information

Event name, specified as a scalar string, a nondimensional, comma-separated string array, or an event or variable name. Enter the event or variable name and then click Update table. The new name appears on the associated table with a check box corresponding to each point. To indicate that an event occurs at a particular point for an event name, select an associated check box. Clear the check box to indicate that no event occurs.

To specify an event name as a MATLAB variable, define the variable in the MATLAB Command Window, and then enter the variable in the live task. The live task replaces the variable name with the definition in the text box parameter.

Example: ["Event1","Event2"]

Example: In the Command Window, specify Events=["Event1","Event2"] and enter ["Events"] in the live task Event names. Observe that the live task replaces Event names with ["Event1", "Event2"].

Data Types: string

Additional reference signal, specified as Lateral acceleration or Turn rate.

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

Output properties

Data type of trajectory data, specified as Timeseries or Timetable.

Initial time of trajectory operation, specified as the current day and time.

Display results

Visualize results as a 3D plot or heading versus time plot.

Select this parameter to generate a 3D plot of the results.

Select this parameter to generate a heading versus time plot of the results.

Select this parameter to generate a turn rate versus time plot of the results.

Select this parameter to generate a lateral rate versus time plot of the results.

Dependencies

To enable this parameter, set Select trajectory type to Bezier, Circular, or Polynomial.

Version History

Introduced in R2026a