主要内容

wirelessNetworkViewer

View wireless networks

Since R2026a

    Description

    Use the wirelessNetworkViewer object to view wireless networks.

    Creation

    Description

    networkViewer = wirelessNetworkViewer creates a default wireless network viewer object.

    networkViewer = wirelessNetworkViewer(PropertyName=Value) sets properties using one or more optional name-value arguments. For example, RefreshRate=5 sets the refresh rate for the viewer to 5.

    example

    Properties

    expand all

    Size of the canvas, specified as one of these options.

    • Two-element vector — The first element is the length, and the second is the breadth. The value of each element must be in the range (0, Inf). Units are in meters.

    • Three-element vector — The elements correspond to length, breadth, and height, respectively. The values of the first and second elements can be in the range (0, Inf), while the value of the third element must be in the range [0, Inf). Note that the object currently ignores the third element and creates a two-dimensional canvas. Units are in meters.

    Data Types: double

    Refresh rate for the viewer, specified as a scalar in the range [0.1, 100].

    When you increase this value, the viewer updates the plots more often, which can slow down the simulation. When you decrease this value, the viewer updates the plots less often, resulting in slower visualization of the updates.

    Data Types: double

    Object Functions

    addNodesAdd wireless nodes to wireless network viewer
    removeNodesRemove nodes from wireless network viewer
    showBoundaryCreate and visualize node placement boundary on canvas
    hideBoundaryRemove placement boundaries from canvas

    Examples

    collapse all

    Generate and visualize the random placement of wireless nodes within a rectangular area. Using the nodePositionRandom function, you distribute ten nodes uniformly inside a 100-by-100 meter region. Then, a wirelessNetworkViewer object displays the resulting node positions.

    Set the area dimensions and number of nodes.

    areaLength = 100;           % Rectangle length (meters)
    areaWidth = 100;            % Rectangle width (meters)
    numNodes = 10;              % Number of random nodes

    Generate random node positions in the rectangle.

    [nodePositions,rectPoly] = nodePositionRandom( ...
        "rectangle",[areaLength areaWidth],NumNodes=numNodes);

    View the positions using the wireless network viewer.

    viewer = wirelessNetworkViewer(CanvasSize=[200 200]);
    addNodes(viewer,nodePositions,Type="RandomNodePositions")

    Show the rectangle boundary.

    showBoundary(viewer, ...
        Position=[0 0 0], ...
        BoundaryShape="rectangle", ...
        Bounds=[areaLength areaWidth], ...
        Name="RectangleBoundary")

    Figure Wireless Network Viewer contains an axes object. The axes object with xlabel X-axis (m), ylabel Y-axis (m) contains 22 objects of type line. One or more of the lines displays its values using only markers These objects represent Canvas Boundary, RandomNodePositions, Boundary.

    Remove the node position by uncommenting this line of code.

    % removeNodes(viewer)

    Hide the rectangle boundary by uncommenting this line of code.

    % hideBoundary(viewer)

    Version History

    Introduced in R2026a