智能反射面(IRS)论文复现

对论文“Compressed Channel Estimation for Intelligent Reflecting Surface-Assisted Millimeter Wave Systems”的仿真

PS:这是博主第一次使用CSDN的博客功能,还没弄熟这些功能,先就这样吧。

智能反射面(IRS)是最近两年比较火的一个东西,但可惜相关IRS的代码都很难找,网上有的代码有些也有问题,对于刚开始接触这个东西的我实在很难受。这篇是博主在参考其他代码的基础上写的,希望能对大家初学IRS有点帮助,如果有问题欢迎大家指正。论文相关原理已有其他博主分析过了,这里就不再赘述。

不过需要需要说明的是:
1.这篇论文实际性能很差,仿真可以验证文章中的结果实际只是挑出来最好的结果。性能差最大的原因是论文把级联信道的估计转化成了SMV问题,在这个过程中把级联信道当成了任意稀疏,实际级联信道是行列块稀疏的,大家可以自己写一个级联信道一看就知道了。
2.关于OMP算法网上有很多,这里就不再放出了

仿真结果:
智能反射面(IRS)论文复现_第1张图片

matlab代码:

clc
clear;
close all;
N = 16; %transmit antennas
Mx = 8; % rows of IRS
My = 8;  % columns of IRS
M = Mx * My; %total elements of IRS
NG = 64;  % number of codewords of IRS
MG_x = 32;
MG_y = 32;
MG = MG_x * MG_y;
L = 3;  % paths of BS-IRS
Lprime = 3;  % paths of IRS-UE
T = 110;
K=10^1.32;%莱斯因子

FL = 1 / sqrt(N) * exp(pi*1j * (0 : N-1)' * (0 : 1/ NG : 1 - 1/NG));
Fx = 1 / sqrt(Mx) * exp(pi*1j * (0 : Mx-1)' * (0  : 1 / MG_x : 1 - 1/MG_x));
Fy = 1 / sqrt(My) * exp(pi*1j * (0 : My-1)' * (-1/2 : 1 / MG_y : 1/2 - 1/MG_y));

Fp = kron(Fx, Fy);
[m,n]=size(Fp);
D=zeros(m,n*n);
for i=1:m
    D(i,:)=kron(conj(Fp(i,:)),Fp(i,:));
end
Du=D(:,1:MG);
v = ones(M, 1);
F_hat = kron(conj(FL), Du);
W =[];
SNR=-10:5:30;%信噪比
count=1;%计数
num=70;%重复次数
NMSE=zeros(num,length(SNR));
NMSE1=zeros(num,length(SNR));
for m=1:num %重复num次
    for l = 1 : L
        ax = 1 / sqrt(Mx) * exp(pi*1j * (0 : Mx-1)' * (rand()));
        ay = 1 / sqrt(My) * exp(pi*1j * (0 : My-1)' * (rand() - 1/2));
        ar = kron(ax, ay);
        at = 1 / sqrt(N) * exp(pi*1j * (0 : N-1)' * (rand()));
        alpha=sqrt(2)/2*(randn(1,1)+1i*randn(1,1)) ;
        if l==1
            GL=alpha * sqrt(K/(K+1))* ar * at';
            GN=0;
        else
            GN = GN +  alpha * sqrt(1/(K+1)) * ar * at';
        end
    end
    G=sqrt(N*M/L)*(GL+GN);
    
    for l = 1 : Lprime
        ax = 1 / sqrt(Mx) * exp(pi*1j * (0 : Mx-1)' * (rand()));
        ay = 1 / sqrt(My) * exp(pi*1j * (0 : My-1)' * (rand() - 1/2));
        at = kron(ax, ay);
        alpha=sqrt(2)/2*(randn(1,1)+1i*randn(1,1)) ;
        if l==1
            hrL=alpha * sqrt(K/(K+1))* at;
            hrN=0;
        else
            hrN = hrN + alpha * sqrt(1/(K+1))* at;
        end
    end
    hr=sqrt(M/Lprime)*(hrN+hrL);
    H = diag(hr') * G;%真实信道
    %noise=[1,0.562,0.316,0.178,0.1,0];%分别对应0,5,10,15,20DB
    for j=1:length(SNR)
        W=[];
        for t = 1 : T
            w = 1 / sqrt(N) * exp(pi*1j * (0 : N-1)' .*  (2*rand(N,1)));
            v = 1 / sqrt(N) * exp(pi*1j * (0 : M-1)' .*  (2*rand(M,1)));
            W = [W; kron(w.', v')];
            %         n = noise(j)*randn(1,1);
            y(t) = awgn(v' * H * w,SNR(j));
        end
        phi = W * F_hat;
        x = CS_OMP(y.',phi, L * Lprime);
        Sigma = reshape(x, MG, NG);
        H_est = Du * Sigma * FL';
        NMSE(count,j) = (norm(H_est - H, 'fro') / norm(H,'fro'))^2;
        %传统LS估计,这一块有独立的时长
        T_1=N*M;
        y1=zeros(T_1,1);
        Wv=[];
        for i=1:T_1
            v=exp(1i*pi.*(rand(M,1)-0.5));
            w=exp(1i*pi.*(rand(N,1)-0.5));%预编码向量
            W=kron(w.',v');
            Wv=[Wv;W];
            y1(i)=awgn(v'*H*w,SNR(j));
        end
        tempel_H_LS=inv(Wv)*y1;
        H_LS=reshape(tempel_H_LS,M,N);
        NMSE1(count,j)=(norm(H_LS - H, 'fro') / norm(H,'fro'))^2;
    end
    count=count+1
end
NMSE_OMP=sum(NMSE(find(NMSE(:,9)<0.09),:))/length(find(NMSE(:,9)<0.09));%找最优的结果
NMSE_LS=sum(NMSE1(find(NMSE1(:,1)<0.01),:))/length(find(NMSE1(:,1)<0.01));%找最优的结果
semilogy(SNR,NMSE_OMP,'-ro');
hold on;
semilogy(SNR,NMSE_LS,'-b>');
hold off;

你可能感兴趣的:(智能反射面,matlab,5g,自然语言处理)