1.完整项目描述和程序获取
>面包多安全交易平台:https://mbd.pub/o/bread/ZJeXlJ9v
>如果链接失效,可以直接打开本站店铺搜索相关店铺:
>如果链接失效,程序调试报错或者项目合作也可以加微信或者QQ联系。
2.部分仿真图预览
3.算法概述
移动自组织网络不但具有终端能量受限、无线信道状况受链路距离影响等特点,还具有节点位置的选择存在偏好的规律。本节建立基于节点位置偏好的网络拓扑演进模型,并利用复杂网络理论对其进行分析。
4.部分源码
.................................................................................
m0 = 9;
m = 8;
N = 1000;
SCALE = 500;%
%通信半径
Radius= 150;%
alpha = 0.5;
Ec = 1/1000;
E0 = 1;
%%
%局域网偏好的网络拓扑
L = 30;
X = rand(1,m0)*SCALE;
Y = rand(1,m0)*SCALE;
fed= [];
for i = 1:m0
for j = 1:m0
dist(i,j)=sqrt((X(i)-X(j))^2+(Y(i)-Y(j))^2);
end
end
indx = 0;
NN = 0;
while NN < N
NN
indx = indx + 1;rng(indx);
%计算度
if indx == 1
X2 = X;
Y2 = Y;
end
degree1 = [];
for i = 1:length(X2)
xx= 0;
for j = 1:length(Y2)
dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
if dist <= Radius & dist > 0
xx= xx + 1;
end
end
degree1(i) = xx;
end
degree2 = [];
di = [];
for i = 1:length(X2)
xx= 0;
for j = 1:length(Y2)
dist=sqrt((X2(i)-X2(j))^2+(Y2(i)-Y2(j))^2);
if dist <= Radius & dist > 0 & dist<= L
xx= xx + 1;
end
di(i,j) = dist;
end
degree2(i) = xx;
end
%计算节点剩余能源
if indx == 1
E(1:m0) = E0 - Ec;
tmps = E;
else
E = tmps - Ec;
E = [E,E0 - Ec];
tmps = E;
end
for i = 1:length(X2)
d = di(i,:);
fed(i) = E(i)^alpha*(1-d(i)/sum(d))^(1-alpha);
end
for i = 1:length(X2)
Para2(i) = fed(i)*degree1(i)/(sum(fed.*degree1));%公式3.3连接8个概率
end
%选择概率最大的m个进行连接
[Vp,Ip] = sort(Para2);
Mindx = Ip(end-m+1:end);
.........................................................
X2 = [X2,Xnew];
Y2 = [Y2,Ynew];
NN = length(X2);
%平均最短路径长度
Eavg = mean(E);
n = xx;
ms = m;
t = 0.005*indx;
k = mean(degree1);
Pked = 1/(m0+t)*(2*n*Eavg./fed*ms/k);
dt = 0.1;
theta = sum(Pked);
kikj = ms^2/Eavg*exp(fed/(2*n*Eavg)*dt);
gamma = 0.5772;
LLs = exp(1/log(theta))*((-1*log(kikj)-log(ms/2)-gamma)/(log((N))+log(ms/2)) + 3/2);
Lens(indx) = mean(LLs);
end
ix = find(abs(Lens)>1000);
Lens(ix)=0;
%平滑
for indx=1:length(Lens)
if indx <= 256
Lens2(indx) = mean(Lens(1:indx));
else
Lens2(indx) = mean(Lens(indx-256:indx));
end
end
figure;
plot(Lens2,'b','linewidth',1);
if L==30
save R0.mat Lens2
end
if L==20
save R1.mat Lens2
end
if L==15
save R2.mat Lens2
end
if L==10
save R3.mat Lens2
end
12_042_m