⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 topo.m

📁 一个无线网络仿真程序
💻 M
字号:
function [node] = topo(maxn, maxx, maxy, drawFigure);
% Generate network topology

% S = rand('state');
% rand('state',0);
node = rand(maxn,2);
node(:,1) = node(:,1)*maxx;
node(:,2) = node(:,2)*maxy;
% rand('state',S);

if drawFigure >= 1
    % make background white, run only once
    colordef none,  whitebg
    figure(1);
    axis equal
    hold on;
    box on;
    % grid on;
    plot(node(:, 1), node(:, 2), 'k.', 'MarkerSize', 5);
    title('Network topology');
    xlabel('X');
    ylabel('Y');
    axis([0, maxx, 0, maxy]);
    set(gca, 'XTick', [0; maxx]);
    set(gca, 'YTick', [maxy]);
end

% line([info(i, 2), info(k, 2)], [info(i, 3), info(k, 3)], 'Color', 'k', 'LineStyle', '-', 'LineWidth', 1.5);
return;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -