用于ofdm后fft波束形成的matlab代码

时间:2013-06-17 07:09:35

标签: arrays matlab signal-processing communication

我想在Matlab中将后FFT波束成形用于AWGN信道中的ODFM系统。在y模拟中,我有4个天线阵列和4个用户。期望第一用户的信号,而其他用户是干扰源。

以下是我获取波束成形器系数(w_opt=inv(R)*P)的代码,该代码使用Communications System Toolbox

%%%%%%%%%% code for computing the beamformer coefficients %%%%%%%%%
clear all
close all
% clc

K=4; % number of users
S=4; % number of arrays
runs=1000;
l=10000;
N=32;
e=zeros(N,l,runs);
DOA=[30 0 140 100];
w_opt_fft=zeros(S,N);
R2=zeros(S,S,N);
p2=zeros(S,N);
F=zeros(N);
for k=1:N
    for q=1:N
        F(k,q)=sqrt(1/N)*exp(-1i*2*pi*(k-1)*(q-1)/N);
    end;
end;
Ft=F'; %'
%%%%%%%%%array response for each user %%%%%%%%%
A=zeros(S,K);
for j=1:K
    for i=1:S
        A(i,j)=exp(1i*(i-1)*pi*cos(DOA(j)*pi/180));
    end
end
FV2=zeros(N,S);
for j=1:l
    sym = randint(N,K,2);
    d=pskmod(sym,2);
    for user=1:K
        X2(:,user)=Ft*d(:,user);
        y2(:,user)=X2(:,user);
    end
    y2_n=awgn(y2,20,'measured');
    V2=A*y2_n.'; %'
    for arr=1:S
        FV2(:,arr)=F*V2(arr,:).'; %'
    end
    for sub=1:N
        R2(:,:,sub)=R2(:,:,sub)+FV2(sub,:)'*FV2(sub,:); %'
        d2(sub)=X2(sub,1);
        p2(:,sub)=p2(:,sub)+FV2(sub,:).'*d2(sub)';
    end
end
for sub=1:N
    R2(:,:,sub)=R2(:,:,sub)/l;
    p2(:,sub)=p2(:,sub)/l;
    w_opt_fft(:,sub)=inv(R2(:,:,sub))*p2(:,sub);
end

save('w_opt_fft.mat','w_opt_fft')


%%%%%%%%%%%% BER Analysis %%%%%%%%%%%%%%
clear all
close all
clc
load 'w_opt_fft.mat'
K=4; % number of users
S=4; % number of arrays
runs=1000;
l=5000;
N=32;
e=zeros(N,l,runs);
DOA=[30 0 140 100];

R1=zeros(S,S,N);
R2=zeros(S,S,N);
p1=zeros(S,N);
p2=zeros(S,N);
ber1=zeros(11,1);
ber2=zeros(11,1);
F=zeros(N);
for k=1:N
    for q=1:N
        F(k,q)=sqrt(1/N)*exp(-1i*2*pi*(k-1)*(q-1)/N);
    end;
end;
Ft=F'; %'
%%%%%%%%%array response for each user %%%%%%%%%
A=zeros(S,K);
for j=1:K
    for i=1:S
        A(i,j)=exp(1i*(i-1)*pi*cos(DOA(j)*pi/180));
    end
end
%%%%%%%
for SNR=0:2:20;
    for j=1:runs
        sym = randint(N,K,2);
        d=pskmod(sym,2);
        for user=1:K
            X2(:,user)=Ft*d(:,user);
            y2(:,user)=X2(:,user);
        end
        y2_n=awgn(y2,SNR,'measured');
        V2=A*y2_n.'; %'
        for arr=1:S
            FV2(:,arr)=F*V2(arr,:).'; %'
        end
        for sub=1:N
            Fout2(sub)=w_opt_fft(:,sub)'*FV2(sub,:).';
        end
        data2=pskdemod(Fout2,2);
        ber2(SNR/2+1)=ber2(SNR/2+1)+sum(sym(:,1)~=data2.'); %'
    end
    ber2(SNR/2+1)=ber2(SNR/2+1)/runs/N;
end
semilogy(0:2:20,ber2,'r','linewidth',2)

然而,波束形成器的系数不正确且Bit Error Rate不好。

0 个答案:

没有答案