天天看点

基于gamebased算法的动态频谱访问matlab仿真

目录

​​一、理论基础​​

​​二、核心程序​​

​​三、测试结果​​

一、理论基础

       随着越来越多的新型无线应用,对频谱资源的需求越来越大。在这种情况下,这是举世公认的认知无线电的出现已经成为一种很有前途的方式解决频谱资源有限的问题。在认知无线电网络(CRN)中,未经授权的用户,在次要用户对主要用户的干扰在可接受水平的情况下,允许动态访问频谱。考虑的场景和系统假设:

基于gamebased算法的动态频谱访问matlab仿真

      我们考虑一个动态频谱接入网,它由一个主用户对和两个辅助用户组成。具体地说,我们将主发射机和接收机分别表示为pu t和pur。两个次要用户(记作A和B)将它们的包传输到认知基站(CBS)。该配置可以扩展到多辅助用户,这不是本文的重点。此外,还有一个窃听者,记作E,试图拦截主传输。假设每个节点都有一个全向天线。

       将节点间信道增益建模为独立的复高斯随机变量。更具体地说,链路的瞬时信道系数P U t − P Ur, P U t − E, A − E, B − E, B −P Ur, A − P Ur, B − CBS, A − CBS被独立的表示为hp, hP E, hAE, hBE, hBP , hAP , hB, hA。独立的加性高斯白噪声在P Ur, E, CBS对A和B来说表示为np, ne, nA, nB, 方差为σ2p, σ2e,σ2A, σ2B,我们表示用户的发射功率A (or B) 为Ppu and Psu。在具有相同的优先级情况下,合理的假设次要用户A和B具有相同的传输能力。

       针对频谱覆盖系统的物理层安全问题,提出了一种基于游戏的干扰方法。为了全面捕捉主用户服务的特点,采用了连续时间马尔可夫链,从而清晰地构建了信道状态转换。二次系统干扰合作的激励因素是调整一次用户的负载因子。采用基于神经网络的干扰方法,不需要对窃听者的CSI进行检测。此外,还设计了概率干扰机制,为游戏参与者提供了更多的自由度。

二、核心程序

.......................................

hP2  = 0.5;
hPE2_= 0.5;
hA2  = 0.5;
hB2  = 0.5;
hAE2 = 0.5;
hBE2 = 0.5;
hAP  = 0.1;
hBP  = 0.1;

SNR  = [6:2:30];
hPE2_= [0.1:0.1:0.9];
dA   = 0.9;
dB   = 0.9;
dP   = 0.9;
dE   = 0.9;
Ppu  = 4;
c    = 0.2;


p_   = zeros(size(hPE2_));
Prate = zeros(size(hPE2_));
for i = 1:length(hPE2_)
    Psu_tmp = 3; 
    hPE2 = hPE2_(i);
    hi   = [hA2,hB2];
    di   = [dA,dB];
    R1   = max(log2(1+Ppu*hP2/dP) - log2(1+Ppu*hPE2/(Psu_tmp*hAE2 + Psu_tmp*hBE2 + dE)),0);
    R2   = max(log2(1+Ppu*hP2/dP) - log2(1+Ppu*hPE2/(dE)),0);
    gamma= max([hi./di]);
    %干扰信号由概率pj
    tmps = 0;
    tmps2= 0;
    for jj = 1:5000
        pj      = 0.8+rand/5;
        up_uplp = 0.18;
        pi1     = up_uplp;
        pi2     = (1-up_uplp)*(1-pj); 
        pi3     = (1-up_uplp)*pj; 
        Up      = pi2*R2 + pi3*R1;
        Rsu     = max([1+Psu_tmp*hi./di]);
        Us      = pi1*Rsu - 2*c*Psu_tmp*pi3;
        %根据us反推p,Psu最大的时候,对应的Us的值
        Up      = Us;
        PP      = Up/((1-pj)*R2 + pj*(log2(1+Ppu*hP2/dP)-log2(1+Ppu*hPE2/(Psu_tmp*hAE2 + Psu_tmp*hBE2 + dE))));
        tmps    = abs(PP);
        Px(jj)  = (1-tmps)/tmps;
        Psuss   = max(1/(2*log(2)*c*Px(jj)*pj) - 1/gamma,0);
        %计算Secondary users’ utility
        R       = max(log2(1+Ppu*hP2/dP) - log2(1+Ppu*hPE2/(Psuss*hAE2 + Psuss*hBE2 + dE)),0);
        Rsu     = max(log2(1+Psuss*hi(1)./di(1)),log2(1+Psuss*hi(2)./di(2)));
        Us      = (pi1*Rsu - 2*c*Psu_tmp*pi3);
        tmps2   = tmps2+1+Us;
    end
    tmps2   = tmps2/5000;
    Prate(i) = tmps2;
end

figure;
plot(hPE2_,Prate,'b-o');
hold on


%下面是简化后的power controller
Prate = zeros(size(hPE2_));
for i = 1:length(hPE2_)
    Psu_tmp = 3; 
    hPE2 = hPE2_(i);
    hi   = [hA2,hB2];
    di   = [dA,dB];
    R1   = max(log2(1+Ppu*hP2/dP) - log2(1+Ppu*hPE2/(Psu_tmp*hAE2 + Psu_tmp*hBE2 + dE)),0);
    R2   = max(log2(1+Ppu*hP2/dP) - log2(1+Ppu*hPE2/(dE)),0);
    gamma= max([hi./di]);
    %干扰信号由概率pj
    tmps = 0;
    tmps2= 0;
    for jj = 1:5000
        pj      = 0.8+rand/5;
        up_uplp = 0.18;
        pi1     = up_uplp;
        pi2     = (1-up_uplp)*(1-pj); 
        pi3     = (1-up_uplp)*pj; 
        Up      = pi2*R2 + pi3*R1;
        Rsu     = max([1+Psu_tmp*hi./di]);
        Us      = pi1*Rsu - 2*c*Psu_tmp*pi3;
        Up      = Us;
        PP      = Up/((1-pj)*R2 + pj*(log2(1+Ppu*hP2/dP)-log2(1+Ppu*hPE2/(Psu_tmp*hAE2 + Psu_tmp*hBE2 + dE))));
        tmps    = abs(PP);
        Px(jj)  = (1-tmps)/tmps;
        Psuss   = max(1/(2*log(2)*c*Px(jj)*pj) - 1/gamma,0);
        %计算Secondary users' utility
        Rsu     = max(log2(1+Psuss*hi(1)./di(1)),log2(1+Psuss*hi(2)./di(2)));
        Rsu     = max([1+Psuss*hi./di]);
        Us      = (pi1*Rsu - 2*c*Psu_tmp*pi3);
        tmps2   = tmps2+1+Us;
    end
    tmps2   = tmps2/5000;
    Prate(i) = tmps2;
end
 
.......................................................      

三、测试结果

继续阅读