Main Content


Add random waypoint mobility model to UE node

Since R2023b

    Download Required: To use addMobility, first download the Communications Toolbox Wireless Network Simulation Library add-on.


    addMobility(ue) adds a random waypoint mobility model to one or more new radio (NR) user equipment (UE) nodes, ue. In the random waypoint model, a wireless node pauses for some duration at a location before moving towards its next random destination (waypoint) with a random speed. The node repeats this process at each waypoint.


    addMobility(ue,Name=Value) sets the random waypoint mobility configuration parameters using one or more optional name-value arguments. For example, PauseDuration=0.02 sets the pause duration of a UE node to 0.02 seconds. If you add random waypoint mobility models to multiple wireless nodes in a single addMobility function call, all the nodes use the mobility parameter values specified by the name-value arguments.


    collapse all

    Initialize wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create a gNB node with these specifications.

    • Duplex mode — Time division duplex

    • Channel bandwidth — 20 MHz

    • Subcarrier spacing — 30 KHz

    gnb = nrGNB(ChannelBandwidth=20e6,DuplexMode="TDD",SubcarrierSpacing=30e3);

    Create a UE node with a transmit power of 20 dBm.

    ue = nrUE(TransmitPower=20);

    Configure these uplink power control parameters at the gNB node.

    • Nominal transmit power of UE per resource block — 7 dBm

    • Fractional power control multiplier— 2


    Add a random way point mobility model to the UE node.


    Establish a connection between the UE and gNB nodes.


    Create a voice over Internet protocol (VoIP) application traffic pattern object.

    traffic = networkTrafficVoIP(GeneratePacket=true);

    Add the data traffic source to the gNB node. Set the destination node as the UE node.


    Add the gNB node to the wireless network simulator.


    Add the UE node to the wireless network simulator.


    Specify the simulation time, in seconds.

    simulationTime = 0.3;

    Run the simulation for the specified simulation time.


    Obtain the statistics for the gNB and UE nodes.

    gnbStats = statistics(gnb);
    ueStats = statistics(ue);

    Input Arguments

    collapse all

    UE node, specified as an nrUE object or an array of nrUE objects.

    Name-Value Arguments

    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: addMobility(ue,PauseDuration=0.02) sets the pause duration for a UE node, after it reaches a target waypoint, to 0.02 seconds.

    Speed range, specified as a two-element numeric vector. The function sets the speed of the UE node according to a continuous uniform distribution based on this range. The first element of the vector specifies the minimum speed of the node, while the second specifies the maximum speed, in meters per second.

    Data Types: double

    Pause duration of the UE node after reaching a target waypoint, specified as a nonnegative scalar. Units are in seconds.

    Data Types: double

    Shape of the node mobility area, specified as "rectangle" or "circle".

    Data Types: char | string

    Center coordinates and dimensions of the mobility area, specified as a three-element or four-element numeric vector, depending on the value of the BoundaryShape argument.

    • "rectangle" — Specify a four-element numeric vector of the form [xcenter ycenter length width]. The default value is [xcurrent ycurrent 10 10], where the first two elements specify the xy-coordinates of current node position.

    • "circle" — Specify a three-element numeric vector of the form [xcenter ycenter radious]. The default value is [xcurrent ycurrent 10], where the first two elements specify the xy-coordinates of current node position.

    Data Types: double

    Version History

    Introduced in R2023b