基于博弈论的频谱分配(MATLAB实现)

代码:

Matlab 复制代码
clc
clear all

B=15;
BER=10^(-4);
K=1.5/(logm(0.2/BER)); SNR=[8,10]; k=log2(1+K.*SNR); r1=10;
r2=12; x=0; y=1; z=1;
% b=[0,0];
% c=x+y*(sum(b));
% p=r.*k.*b-b.*c;


a(1)=0.001;
for i=1:300 a(2)=0.001;
for j=1:300
eigenvalue(1)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)- a(2)*k(1))+10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)- a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
eigenvalue(2)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)-a(2)*k(1))-10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)-a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
if (eigenvalue(1)<1)&&(eigenvalue(1)>- 1)&&(eigenvalue(2)<1)&&(eigenvalue(2)>-1)
a(2)=a(2)+0.002;
end
end
if a(2)>0
a(2)=a(2)-0.002;
else
a(2)=0;
end
f2(i)=a(2);
f1(i)=a(1);
a(1)=a(1)+0.002;
end
figure(1)
plot(f1,f2,'--r')
axis([0,0.25,0,0.25])
hold on


B=15;
BER=10^(-4);
K=1.5/(logm(0.2/BER)); SNR=[10,10]; k=log2(1+K.*SNR); r1=10;
r2=12; x=0; y=1; z=1;
% b=[0,0];
% c=x+y*(sum(b));
% p=r.*k.*b-b.*c;


a(1)=0.001;
for i=1:300 a(2)=0.001;
for j=1:300
eigenvalue(1)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)- a(2)*k(1))+10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)- a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
eigenvalue(2)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)-a(2)*k(1))-10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)-a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
if (eigenvalue(1)<1)&&(eigenvalue(1)>- 1)&&(eigenvalue(2)<1)&&(eigenvalue(2)>-1)
a(2)=a(2)+0.002;
end
end
if a(2)>0
a(2)=a(2)-0.002;
else
a(2)=0;
end
f2(i)=a(2);
f1(i)=a(1);
a(1)=a(1)+0.002;
end
figure(1) 
plot(f1,f2,'-.*b')
axis([0,0.25,0,0.25])
B=15;
BER=10^(-4);
K=1.5/(logm(0.2/BER));
SNR=[10,8]; k=log2(1+K.*SNR); r1=10;
r2=12; x=0; y=1; z=1;
% b=[0,0];
% c=x+y*(sum(b));
% p=r.*k.*b-b.*c;


a(1)=0.001;
for i=1:300 a(2)=0.001;
for j=1:300
eigenvalue(1)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)- a(2)*k(1))+10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)- a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
eigenvalue(2)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)-a(2)*k(1))-10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)-a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
if (eigenvalue(1)<1)&&(eigenvalue(1)>- 1)&&(eigenvalue(2)<1)&&(eigenvalue(2)>-1)
a(2)=a(2)+0.002;
end
end
if a(2)>0
a(2)=a(2)-0.002;
else
a(2)=0;
end
f2(i)=a(2);
f1(i)=a(1);
a(1)=a(1)+0.002;
end
figure(1)
plot(f1,f2,'-g')
axis([0,0.25,0,0.25])
B=15;
BER=10^(-4);
K=1.5/(logm(0.2/BER));
SNR=[7,7]; k=log2(1+K.*SNR); r1=10;
r2=12; x=0; y=1; z=1;
% b=[0,0];
% c=x+y*(sum(b));
% p=r.*k.*b-b.*c;


a(1)=0.001;
for i=1:300 a(2)=0.001;
for j=1:300
eigenvalue(1)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)- a(2)*k(1))+10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)- a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
eigenvalue(2)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)-a(2)*k(1))-10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)-a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
if (eigenvalue(1)<1)&&(eigenvalue(1)>- 1)&&(eigenvalue(2)<1)&&(eigenvalue(2)>-1)
a(2)=a(2)+0.002;
end
end
if a(2)>0
a(2)=a(2)-0.002;
else
a(2)=0;
end
f2(i)=a(2);
f1(i)=a(1);
a(1)=a(1)+0.002;
end
figure(1)
plot(f1,f2,'-.y')
axis([0,0.25,0,0.25])
B=15;
BER=10^(-4);
K=1.5/(logm(0.2/BER)); SNR=[8,8]; k=log2(1+K.*SNR); r1=10;
r2=12; x=0; y=1; z=1;
% b=[0,0];
% c=x+y*(sum(b));
% p=r.*k.*b-b.*c;


a(1)=0.001;
for i=1:300 a(2)=0.001;
for j=1:300
eigenvalue(1)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)- a(2)*k(1))+10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)- a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
eigenvalue(2)=1-10/3*(2*a(1)*k(1)-a(1)*k(2)+2*a(2)*k(2)-a(2)*k(1))-10/3*((a(1)*(k(2)-2*k(1))*a(2)*(k(1)-2*k(2))+(2*a(2)*k(2)-a(2)*k(1)-2*a(1)*k(1)+a(1)*k(2))^2)^(0.5));
if (eigenvalue(1)<1)&&(eigenvalue(1)>- 1)&&(eigenvalue(2)<1)&&(eigenvalue(2)>-1)
a(2)=a(2)+0.002;
end
end
if a(2)>0
a(2)=a(2)-0.002;
else
a(2)=0;
end
f2(i)=a(2);
f1(i)=a(1);
a(1)=a(1)+0.002;
end


figure(1)
plot(f1,f2,'om') 
axis([0,0.25,0,0.25])
legend('r1=8dB,r2=10dB','r1=10dB,r2=10dB','r1=10dB,r2=8dB','r1=7dB,r2=7dB','r1=8dB,r2=8dB')
xlabel('a1')
ylabel('a2')

结果:

相关推荐
Yz9876几秒前
hive的存储格式
大数据·数据库·数据仓库·hive·hadoop·数据库开发
苏-言12 分钟前
Spring IOC实战指南:从零到一的构建过程
java·数据库·spring
Ljw...18 分钟前
索引(MySQL)
数据库·mysql·索引
火山口车神丶29 分钟前
某车企ASW面试笔试题
c++·matlab
菠萝咕噜肉i32 分钟前
超详细:Redis分布式锁
数据库·redis·分布式·缓存·分布式锁
长风清留扬34 分钟前
一篇文章了解何为 “大数据治理“ 理论与实践
大数据·数据库·面试·数据治理
OpsEye1 小时前
MySQL 8.0.40版本自动升级异常的预警提示
数据库·mysql·数据库升级
Ljw...1 小时前
表的增删改查(MySQL)
数据库·后端·mysql·表的增删查改
今天吃饺子1 小时前
2024年SCI一区最新改进优化算法——四参数自适应生长优化器,MATLAB代码免费获取...
开发语言·算法·matlab
远歌已逝4 小时前
维护在线重做日志(二)
数据库·oracle