Contenuto principale

nodeMobilityRandomWalk

Implement random walk 2-D mobility model

Since R2026a

    Description

    Use the nodeMobilityRandomWalk object to implement a random walk 2-D mobility model.

    Creation

    Description

    randomWalkModel = nodeMobilityRandomWalk creates a default random walk 2-D mobility model.

    randomWalkModel = nodeMobilityRandomWalk(PropertyName=Value) sets properties using one or more optional name-value arguments. For example, BoundaryShape="circle" sets the shape of the node mobility area to "circle".

    Note that, in the random walk model, a wireless node moves in a random direction either for a fixed amount of time (constant-time mode) or a fixed distance (constant distance mode). In constant-time mode, the node changes direction after traveling for a fixed duration, and its speed might change randomly. In constant-distance mode, the node changes direction after traveling a specified distance, and its speed might also change randomly.

    Properties

    expand all

    Speed range, specified as a two-element row vector. The first element indicates the minimum speed and the second element indicates the maximum speed of the node, both drawn from a continuous uniform distribution. Units are in meters per second.

    To set the speed to a constant value, specify SpeedRange as a two-element row vector with identical values.

    Data Types: single | double

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

    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. Units are in meters.

    • "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 x- and y-coordinates of current node position. You can also specify this value as a column vector.

    • "circle" — Specify a three-element numeric vector of the form [xcenter ycenter radius]. The default value is [xcurrent ycurrent 10], where the first two elements are the x- and y-coordinates of the current node position. You can also specify this value as a column vector.

    Data Types: single | double

    Mode of random walk, specified as "time" or "distance".

    Time after which the speed and direction change, specified as a positive scalar. Units are in seconds.

    Data Types: single | double

    Distance after which the speed and direction change, specified as a positive scalar. Units are in meters.

    Data Types: single | double

    Refresh interval, specified as a nonnegative numeric scalar. The nodeMobilityRandomWalk object updates the position and velocity information once during this refresh interval, but only when a subclass of wnet.Node request it. The units are in seconds.

    Note that, if you set RefreshInterval to 0, the object updates position and velocity information immediately whenever a subclass of wnet.Node requests it.

    Data Types: single | double

    Examples

    collapse all

    This command creates the random walk mobility model with all default settings.

    randomWalkModel = nodeMobilityRandomWalk
    randomWalkModel = 
      nodeMobilityRandomWalk with properties:
    
               WalkMode: "time"
                   Time: 1
             SpeedRange: [0.4150 1.6600]
          BoundaryShape: "rectangle"
                 Bounds: [0 0 10 10]
        RefreshInterval: 0.1000
    
    

    This syntax sets specific properties for the random walk mobility model using name-value arguments.

    randomWalkModel = nodeMobilityRandomWalk( ...
        BoundaryShape= "circle", ...
        Bounds=[0 0 20], ...           % Center at (0,0), radius 20
        SpeedRange=[1 2], ...          % Speed range between 1 and 2 (Units are in meters per second)
        WalkMode="distance", ...       % Change direction after a fixed distance
        Distance= 5, ...               % Change direction every 5 meters
        RefreshInterval= 0.1)          % Refresh every 0.1 seconds
    randomWalkModel = 
      nodeMobilityRandomWalk with properties:
    
               WalkMode: "distance"
               Distance: 5
             SpeedRange: [1 2]
          BoundaryShape: "circle"
                 Bounds: [0 0 20]
        RefreshInterval: 0.1000
    
    

    Version History

    Introduced in R2026a