current position:Home>Matlab simulation of channel capacity based on power allocation and subcarrier pairing algorithm in m-diversity 2-hop OFDM system

Matlab simulation of channel capacity based on power allocation and subcarrier pairing algorithm in m-diversity 2-hop OFDM system

2022-11-24 22:14:45i love c programming

目录

1.算法描述

2.仿真效果预览

3.MATLAB部分代码预览

4.完整MATLAB程序


1.算法描述

       With the rapid development of contemporary wireless communications,Wireless spectrum resources have become increasingly scarce,Traditional fixed and static wireless spectrum allocation mode and strategy,It is difficult to provide more available wireless spectrum bandwidth and higher spectrum utilization for the further development of wireless communication in the future.Cognitive radio technology is one of the key technologies to realize dynamic spectrum opportunity access and effectively solve the problem of scarcity of wireless spectrum resources.;Orthogonal frequency division multiplexing technology has strong anti-multipath interference and anti-frequency selective fading ability,And the advantages of high spectrum utilization,making it one of the ideal candidates for implementing cognitive radio systems.Power distribution is not only the key core technology in the traditional OFDM system,It is also an important means of spectrum analysis and judgment in cognitive radio systems..In the cognitive radio system,Maximization of channel capacity for cognitive user communication links,Also need to deepen the research on power allocation.Based on orthogonal frequency division multiplexing modulation subcarrierIEEE802.11aDownlink Cognitive Radio System,Research on transmit power allocation algorithm.

       本课题,our references《Power Allocation and Subcarrier Pairing Algorithm
for Regenerative OFDM Relay System》对OFDMThe power allocation and channel capacity of the subcarrier pairing algorithm are performedmatlabSimulation Analysis Research.

        With the rapid development of wireless communication,More and more wireless spectrum resources are needed,The current spectrum resource has become more and more scarce.Cognitive radio provides a means to share and utilize spectrum in an opportunistic manner,可以有效地解决这一问题.Cognitive radio technology senses unused spectrum in communication environment through intelligence,And use it to improve the efficiency of spectrum utilization.OFDMThe spectrum utilization efficiency is high,And it has strong anti-frequency selective fading characteristics,已成为4GThe main application technology.With the continuous improvement of people's requirements for communication services and quality,OFDMTechnology is becoming more and more widely applied.OFDMIn order to maximize the system capacity, the system usually allocates reasonable power to system users,Therefore the power distribution isOFDMOne of the key construction techniques of the system. 

       在基于OFDMin the cognitive radio system,Authorized users will be interfered by cognitive user in-band subcarrier out-of-band sidelobe leakage power.A power control parameter is introduced here to adjust the interference power constraint value of authorized users,An optimal power allocation algorithm among subcarriers for cognitive users is proposed,Obtain the optimal power allocation scheme by solving a convex optimization problem.仿真结果表明:与其他算法相比,The power allocation scheme obtained by this method,Under the condition that the authorized user interference power constraint value is satisfied,Can maximize channel capacity for cognitive users.

       为了使NThe sub-channel signals can be completely separated when receiving,In the duration of each element to be metTs内,Any two carriers are orthogonal to each other.三角函数系{1,sint,cost,...,sinnt,cosnt,...}Satisfy that any two different functions are mutually orthogonal(在[−π,π]The integral of the product of two different functions is0),利用这一性质,Carriers that are mutually orthogonal to each other can be obtained.From the perspective of time domain,The superposition of the signal at the sending end in space can be written as:

       It can be seen from the plural form,when the timet进行离散化,OFDMIn fact, it is the transmission signal on each subcarrier(Bi)Performed the operation of finding the inverse Fourier transform,OFDMAlso used when modulatingIFFT模块实现的.  

       从频域上来看OFDM.调制时,In the time domain is a sinusoidal carrier and a symbol waveform(门函数)的乘积,The frequency domain reflects the shift of the spectrum of the gate function(The spectrum of the gate function issinc函数),OFDMIn order to ensure the orthogonality of the carrier,Minimum subcarrier spacingΔf=1Ts.  

2.仿真效果预览

matlab2022a仿真结果如下:

 

3.MATLAB部分代码预览

%%
%不分集OFDM的功率分配不带子载波配对算法下的信道容量;
%PA without pairing without diversity
C1  = 0;
C1s = 0;
for Ss = 1:length(Dist_Tx_Rn)
    Ss
    %利用蒙特卡洛算法思想,进行多次的循环,再计算平均
    for q=1:Simu_Times
        for Ts = 1:Time_Slot
            Cha      = 0.5e-1*random('rayleigh',1,N_hop/Time_Slot,Num_sc);
            Sub      = zeros(N_hop/Time_Slot,Num_sc);%每跳的子载波分布向量
            Capacity = zeros(1,N_hop/Time_Slot);     %定义容量向量
            for i=1:N_hop/Time_Slot
                %每一跳噪声设定
                n0        = randn(1,10000)*sqrt(SCB*0.5e-10);      
                N0        = std(n0,1,2)^2/SCB;
                %选择其中的min值
                [a,ind]   = min(Cha(:,Time_Slot));   
                %将选中的载波的信道因子赋值给该跳的子载波分布向量
                Sub(i,ind)= a;                      
                %进行注水功率分配
                [Capacity1(i),Powers1] = pwrallo(SP,Sub(i,:),SCB,N0,gammar); 
                %载波被某一跳占用,将所有跳上的该载波信道因子设为0
                Cha(:,ind)             = 0;     
            end
            while max(Cha(:))> 0               %判断是否有未分配的载波,有的话继续分配
                [b,indexmin] = min(Capacity1);  %找出速率最小的跳
                i            = indexmin;
                [c,indexmax] = max(Cha(i,:)); %给最小的跳分配载波
                k            = indexmax;
                Sub(i,k)     = c;
                [Capacity1(i),Powers1] = pwrallo(SP,Sub(i,:),SCB,N0,gammar);
                Cha(:,k)     = 0;
            end     
        end
        for kk = 1:length(Powers1)
            h1k    = func_h1(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(2),kk);
            h2k    = func_h2(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(3),kk);
            delta  = (SNR)^2/2;
            a1k    = (abs(h1k))^2/delta;
            a2k    = (abs(h2k))^2/delta;
            Pk     = Powers1(kk)+1/((a1k*a2k)/(a1k+a2k));
            C1(kk) = log2(1 + (a1k*a2k)/(a1k+a2k)*Pk); 
        end
        C1s(q) = SB/(2*Num_sc)*sum(C1); 
    end
    PA_Wo_P(Ss) = mean(C1s)/1e6;
end
%**************************************************************************
%**************************************************************************
%**************************************************************************
%************************************************************************** 
 
 
 
%%
%不分集OFDM的均匀功率分配带子载波配对算法下的信道容量;
%uniform PA without pairing without diversity
for Ss = 1:length(Dist_Tx_Rn)
    Ss
    %利用蒙特卡洛算法思想,进行多次的循环,再计算平均
    for q=1:Simu_Times
        %通过注水法得到的每个Powers1,然后进行sub_carrier pairing
        %通过注水法得到的每个Powers1,然后进行sub_carrier pairing
        Num_sc1 = randperm(Num_sc);
        Num_sc2 = randperm(Num_sc);        
        for kk = 1:length(Num_sc2)
            h1k(kk)= func_h1(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(2),Num_sc1(kk));
            h2k(kk)= func_h2(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(3),Num_sc2(kk));
            hk(kk) = h1k(kk)*h2k(kk)/(h1k(kk) + h2k(kk));
            delta  = (SNR)^2/2;
            a1k(kk)= (abs(h1k(kk)))^2/delta;
            a2k(kk)= (abs(h2k(kk)))^2/delta;
        end
        %排序
        A1k = sort(a1k);
        A2k = sort(a2k);
        for kk = 1:Num_sc
            %均匀分配
            Pk      = SP/Num_sc;
            tmp1(kk)=(A1k(kk)*A2k(kk))/(A1k(kk)+A2k(kk));
            C1(kk)  = log2(1 + tmp1(kk)*Pk); 
        end
        C1s(q) = SB/(2*Num_sc)*sum(C1); 
    end
    uPA_W_P(Ss) = mean(C1s)/1e6;
end
%**************************************************************************
%**************************************************************************
%**************************************************************************
%**************************************************************************
 
 
 
%%
%不分集OFDM的均匀功率分配不带子载波配对算法下的信道容量;
%uniform PA without pairing without diversity
for Ss = 1:length(Dist_Tx_Rn)
    Ss
    %利用蒙特卡洛算法思想,进行多次的循环,再计算平均
    for q=1:Simu_Times
        Num_sc1 = randperm(Num_sc);
        Num_sc2 = randperm(Num_sc);
        for kk = 1:Num_sc
            h1k(kk)    = func_h1(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(2),Num_sc1(kk));
            h2k(kk)    = func_h2(Delay,Gain,Num_sc,SB,Dist_Tx_Rn(Ss),Path_loss_factor(3),Num_sc2(kk));
            delta      = (SNR)^2/2;
            a1k(kk)    = (abs(h1k(kk)))^2/delta;
            a2k(kk)    = (abs(h2k(kk)))^2/delta;
            %均匀分配
            Pk         = SP/Num_sc;
            tmp2(kk)   =(a1k(kk)*a2k(kk))/(a1k(kk)+a2k(kk));
            C1(kk)     = log2(1 + tmp2(kk)*Pk); 
        end
        C1s(q) = SB/(2*Num_sc)*sum(C1); 
    end
    uPA_Wo_P(Ss) = mean(C1s)/1e6;
end
01_064_m

4.完整MATLAB程序

matlab源码说明_我爱C编程的博客-CSDN博客

V

copyright notice
author[i love c programming],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/328/202211242158495771.html

Random recommended