📄 gt.m
字号:
clear all;
close all
N=2; % Two active links
iter=20; % 迭代次数
H=[0.2764,0.5345;0.5432,0.2344]; % 信道增益
R1=60; % 数据速率
L1=5; % 信息bit
M1=10; % 数据bit
L2=3;
M2=6;
R2=15;
Bn=0.05; %背景噪声
alpha=0.01; % 跳时增益
lamda=[0.05,0.075,0.1]; % Linear Price Function
P1=zeros(3,9); %初始化发送功率
P2=zeros(3,9);
I1=zeros(3,9);
I2=zeros(3,9);
for m=1:length(lamda)
for n=2:iter
I1(m,n)=H(1,1)/[R1*(Bn+alpha*P2(m,n-1)*H(2,1))];
P1(m,n)=-log(1-(lamda(m)/(I1(m,n)*L1*R1))^(1/(M1-1)))/I1(m,n);
I2(m,n)=H(2,2)/[R2*(Bn+alpha*P1(m,n-1)*H(1,2))];
P2(m,n)=-log(1-(lamda(m)/(I2(m,n)*L2*R2))^(1/(M2-1)))/I2(m,n);
U1(m,n)=-((L1/M1)*R1*(1-exp(-I1(m,n)*P1(m,n)))^M1)+(lamda(m)*P1(m,n));
U2(m,n)=-((L2/M2)*R2*(1-exp(-I2(m,n)*P2(m,n)))^M2)+(lamda(m)*P2(m,n));
end
end
plot(P1(1,:),'r+-');
hold on
plot(P1(2,:),'go-');
plot(P1(3,:),'b*-');
xlabel('Iteration');
ylabel('Transmission power of Wimax');
legend('lamda=0.05','lamda=0.075','lamda=0.1');
figure;
plot(U1(1,:),'r+-');
hold on
plot(U1(2,:),'go-');
plot(U1(3,:),'b*-');
xlabel('Iteration');
ylabel('Utility function of Wimax');
legend('lamda=0.05','lamda=0.075','lamda=0.1');
figure;
plot(P2(1,:),'r+-');
hold on
plot(P2(2,:),'go-');
plot(P2(3,:),'b*-');
xlabel('Iteration');
ylabel('Transmission power of UWB');
legend('lamda=0.05','lamda=0.075','lamda=0.1');
figure;
plot(U2(1,:),'r+-');
hold on
plot(U2(2,:),'go-');
plot(U2(3,:),'b*-');
xlabel('Iteration');
ylabel('Utility function of UWB');
legend('lamda=0.05','lamda=0.075','lamda=0.1');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -