gen_traffic.m
来自「L. Dong and A. P. Petropulu, 揗ultichan」· M 代码 · 共 24 行
M
24 行
% generate Poisson traffic
% we simply used Binomial traffic, because binomial distribution is close to Poisson distribution when the
% number of total simulated slots is large
% M: number of total simulated slots
% J: number of users
% simurange: number of simulated points of traffic
function [total_Traffic,WorkLoad] = gen_traffic(M, J, simurange);
total_Traffic = zeros(J,M+J,simurange); %dim 3 workload, dim 1 users, dim2 timeslots
WorkLoad = zeros(1,simurange);
traffic_array = zeros(J,M+J);
for ptii=1:simurange
Lamda=(ptii-1)/simurange+0.01;
rand('state',sum(100*clock))
traffic_array = rand(J,M+J)< Lamda/J;
total_Traffic(:,:,ptii)=traffic_array;
for wlii=1:J
WorkLoad(ptii) = WorkLoad(ptii) + mean(traffic_array(wlii,:));
end
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?