1.算法运行效果图预览
2.算法运行软件版本
matlab2022a
3.算法理论概述
在OFDM通信系统中,资源分配是一项关键任务,它涉及将可用的频谱资源和功率分配给不同的子载波,以实现高效的数据传输。为了降低计算复杂度并提高系统性能,低复杂度的资源分配算法成为研究的焦点之一。OFDM(正交频分复用)是一种广泛用于无线通信的调制技术,它将高速数据流分成多个低速子流,并将它们调制在不同的正交子载波上。这样可以减少多径干扰,提高频谱利用率。
4.部分核心程序
[~,pow2] = func_subcarriers_capacity(Ptotal, ch, N_subcarrier, K, noise, gamma);
%功率分配
tic
ianp = func_power(ch,pow2,N_subcarrier,K,Ptotal,noise,gamma);
time_end2 = toc;
Avg_time2(ij1) = Avg_time2(ij1) + time_end2;
for i=1:K
pow1_water(i) = func_waterfilling(shenp(i),pow1(i,:).*ch(i,:)/noise)/N_subcarrier;
pow2_water(i) = func_waterfilling(ianp(i),pow2(i,:).*ch(i,:)/noise)/N_subcarrier;
end;
cap2=cap2+sum(pow1_water);
cap1=cap1+sum(pow2_water);
if ij2 == 1
cap_m1 = cap_m1 + pow1_water;
cap_m2 = cap_m2 + pow2_water;
end
norm1 = norm1 + norm(pow2_water/sum(pow2_water) - gamma/sum(gamma), inf);
norm2 = norm2 + norm(pow1_water/sum(pow1_water) - gamma/sum(gamma), inf);
end
if ij2 == 1
cap_m1 = cap_m1/(N_ch*MTKL);
cap_m2 = cap_m2/(N_ch*MTKL);
figure(5);
bar([gamma/sum(gamma); cap_m2/sum(cap_m2); cap_m1/sum(cap_m1)]', 'grouped');
legend('Gamma方法', 'LINEAR方法', 'ROOT-FINDING方法');
end;
end
cap1_mean(ij1)=cap1/(N_ch*MTKL);
cap2_mean(ij1)=cap2/(N_ch*MTKL);
norm1_mean(ij1) = norm1/(N_ch*MTKL);
norm2_mean(ij1) = norm2/(N_ch*MTKL);
end
figure(1)
plot(diff_Vuser,cap1_mean,'-bs',...
'LineWidth',1,...
'MarkerSize',6,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[0.9,0.0,0.0]);
hold on
plot(diff_Vuser, cap2_mean,'-r>',...
'LineWidth',1,...
'MarkerSize',6,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[0.9,0.9,0.0]);
grid on
xlabel('用户数')
ylabel('容量 (bit/s/Hz)')
legend('LINEAR', 'ROOT-FINDING');
hold off
Avg_time = Avg_time/(N_ch*MTKL);
Avg_time2 = Avg_time2/(N_ch*MTKL);
figure(3);
semilogy(diff_Vuser,Avg_time2,'-bs',...
'LineWidth',1,...
'MarkerSize',6,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[0.9,0.0,0.0]);
hold on
semilogy(diff_Vuser,Avg_time,'-r>',...
'LineWidth',1,...
'MarkerSize',6,...
'MarkerEdgeColor','k',...
'MarkerFaceColor',[0.9,0.9,0.0]);
grid on
xlabel('用户数')
ylabel('平均仿真时间 (s)')
legend('LINEAR', 'ROOT-FINDING');