1.软件版本
matlab2013b
2.本算法理论知识
在协作传输中,把业务流分拆到不同网络进行传输可解决单一网络无法传输的问题,同时降低接入阻塞率并提高网络利用率。随机接入的退避机制决定了碰撞率随接入用户数的增多而快速增大。因此,盲目追求资源分配的公平性对数据流进行拆分和并行传输相当于增加了网络的用户数,会导致随机接入网络的性能快速下降。本课题要求用信道利用率描述网络状态,构造相应的价格函数对速率分配进行协调,按照最小接入代价获取最大吞吐量收益的原则对速率分配进行建模。
3.部分源码
clc;
clear;
close all;
warning off;
%初始化网络可用带宽,注意,论文中场景2给出了网络的可用带宽
%但场景1却没给出这个指标,下面几个参数根据论文的结论推导的
miu1 = 3;
miu2 = 2.5;
miu3 = 1.5;
%初始化网络权值
Fz(1) = 1/miu1;
Fz(2) = 1/miu2;
Fz(3) = 1/miu3;
w = Fz/sum(Fz);
wpj = Fz/sum(Fz);
miu = [miu1,miu2,miu3];
%仿真尺度
Stime = [0:0.5:10];
%开始循环
Ind = 0;
for i = Stime
Ind = Ind + 1;
%本文算法
%本文算法
%计算剩余贷款
LBS1(Ind) = w(1)*(sum(miu)-i);
LBS2(Ind) = w(2)*(sum(miu)-i);
LBS3(Ind) = w(3)*(sum(miu)-i);
%进行速率的分配
x1(Ind) = miu1 - LBS1(Ind);
x2(Ind) = miu2 - LBS2(Ind);
x3(Ind) = miu3 - LBS3(Ind);
%N=3;
if LBS3(Ind) > miu3
x3(Ind) = 0;
w1 = Fz/sum(Fz(1:2));
LBS1(Ind) = w1(1)*(LBS1(Ind)/w(1) - miu3);
LBS2(Ind) = w1(2)*(LBS2(Ind)/w(2) - miu3);
%进行速率的分配
x1(Ind) = miu1 - LBS1(Ind);
x2(Ind) = miu2 - LBS2(Ind);
end
if LBS2(Ind) > miu2
x2(Ind) = 0;
w11 = Fz/sum(Fz(1));
LBS1(Ind) = w11(1)*(LBS1(Ind)/w1(1)-miu2);
%进行速率的分配
x1(Ind) = miu1 - LBS1(Ind);
end
if LBS3(Ind) > miu3
x3(Ind) = 0;
end
x1(Ind) = min(x1(Ind),miu(1));
x2(Ind) = min(x2(Ind),miu(2));
x3(Ind) = min(x3(Ind),miu(3));
R1(Ind) = x1(Ind)/miu(1);
R2(Ind) = x2(Ind)/miu(2);
R3(Ind) = x3(Ind)/miu(3);
Rs =(R1(Ind)+R2(Ind)+R3(Ind))^2;
Rm =(R1(Ind)^2+R2(Ind)^2+R3(Ind)^2)*3;
I1(Ind) = Rs/Rm;
%平均分配算法
%平均分配算法
wpj = [1/3,1/3,1/3];
LBS1pj(Ind) = wpj(1)*(sum(miu)-Ind/3);
LBS2pj(Ind) = wpj(2)*(sum(miu)-Ind/3);
LBS3pj(Ind) = wpj(3)*(sum(miu)-Ind/3);
%进行速率的分配
x1pj(Ind) = miu1 - LBS1pj(Ind);
x2pj(Ind) = miu2 - LBS2pj(Ind);
x3pj(Ind) = miu3 - LBS3pj(Ind);
x1pj(Ind) = min(x1pj(Ind),miu(1));
x2pj(Ind) = min(x2pj(Ind),miu(2));
x3pj(Ind) = min(x3pj(Ind),miu(3));
R1pj(Ind) = x1pj(Ind)/miu(1);
R2pj(Ind) = x2pj(Ind)/miu(2);
R3pj(Ind) = x3pj(Ind)/miu(3);
Rs =(R1pj(Ind)+R2pj(Ind)+R3pj(Ind))^2;
Rm =(R1pj(Ind)^2+R2pj(Ind)^2+R3pj(Ind)^2)*3;
I2(Ind) = Rs/Rm;
%比例分配算法
%比例分配算法
x1(Ind) = min(miu(1)/sum(miu)*i,miu(1));
x2(Ind) = min(miu(2)/sum(miu)*i,miu(2));
x3(Ind) = min(miu(3)/sum(miu)*i,miu(3));
R1(Ind) = x1(Ind)/miu(1);
R2(Ind) = x2(Ind)/miu(2);
R3(Ind) = x3(Ind)/miu(3);
Rs =(R1(Ind)+R2(Ind)+R3(Ind))^2;
Rm =(R1(Ind)^2+R2(Ind)^2+R3(Ind)^2)*3;
I3(Ind) = Rs/Rm;
end
figure;
plot(Stime,I1,'-^');
hold on;
plot(Stime,I2,'-x');
hold on;
plot(Stime,I3,'-s');
hold on;
title('场景1')
legend('本文算法','平均分配算法','比例分配算法')
xlabel('数据流速率/(10^3 kb.s-1)')
ylabel('速率分配/(10^6 kb.s-1)')
% axis([0,20,0,1]);
4.仿真结论
标签:异构,min,接入,miu3,sum,随机,Ind,miu,Fz From: https://www.cnblogs.com/matlabfpga/p/17001836.html