⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c14_threeray.m

📁 在这个例子中
💻 M
字号:
%在这个例子中,我们对有三条固定路径的AWGN多径信道中的QPSK系统进行BER性能仿真,并与在理想的AWGN信道(没有多径)中同样系统的BER性能进
%行比较。为了简化模型,我们做如下假设:
%1,信道中有三条路径,包括一条是衰落的LOS路径和两条具有瑞利分量的路径。与各路径相应的接收功率级以及路径间的延迟差是仿真的参数。
%2,信道的瑞利衰落仅影响发送信号的幅度,不影响瞬时相位
%在符号间隔内各多径分量的衰减幅度是常数,并与相邻间隔无关(不需要多普勒频谱成型)
%4,没有使用发射机滤波,接收机模型也是理想的积分—清除接收机。
%主程序:
%file c14_threeray.m
%
%Default parameters
%
NN=256;      %number of symbols
tb=0.5;        %bit time
fs=16;         %samples /symbol
ebn0db=[1:2:14];      %Eb/N0 vector 
%
%Establish Qpsk signals
%
x=random_binary(NN,fs)+i*random_binary(NN,fs); %QPSK signal
%
%Input powers and delays
%
p0=input('Enter p0>');
p1=input('Enter p1>');
p2=input('Enter p2>');
delay=input('Enter tau>');
delay0=0;delay1=0;delay2=delay;
%
%Set up the Complex Gaussian (Rayleigh) gains
%
gain1=sqrt(p1)*abs(randn(1,NN)+i*randn(1,NN));
gain2=sqrt(p2)*abs(randn(1,NN)+i*randn(1,NN));
for k=1:NN
    for kk=1:fs
        index=(k-1)*fs+kk;
        ggain1(1,index)=gain1(1,k);
        ggain2(1,index)=gain2(1,k);
    end
end
y1=x;
for k=1:delay2
    y2(1,k)=y1(1,k)*sqrt(p0);
end
for k=(delay2+1):(NN*fs)
    y2(1,k)=y1(1,k)*sqrt(p0)+...
        y1(1,k-delay1)*ggain1(1,k)+...
        y1(1,k-delay2)*ggain2(1,k);
end
%
%Match filter
%
b=-ones(1,fs); b=b/fs; a=1;
y=filter(b,a,y2);
%
%ENd of simulation
%
%Use the semianalytic BER estimator .The following sets up the semi
%analytic estimator. Find the maximum magnitude of the cross correlation
%and the corresponding lag.
%
[cor lags]=vxcorr(x,y);
cmax=max(max(abs(cor)));
nmax=find(abs(cor)==cmax);
timelag=lags(nmax);
corrmag=cmax;
theta=angle(cor(nmax))
y=y*exp(-i*theta); %derotate
%
%Noise BW calibration
%
hh=impz(b,a); ts=1/16; nbw=(fs/2)*sum(hh.^2);
%
%Delay the input ,and do BER estimation on the last 128 bits
%Use middle sample .Make sure the index does not exceed number
%of input points. Eb should be computed at the receiver input.
%
index=(10*fs+8:fs:(NN-10)*fs+8);
xx=x(index);
yy=y(index-timelag+1);
[n1 n2]=size(y2); ny2=n1*n2;
eb=tb*sum(sum(abs(y2).^2))/ny2;
eb=eb/2;
[peideal,pesystem]=qpsk_berest(xx,yy,ebn0db,eb,tb,nbw);
figure
semilogy(ebn0db,peideal,'b*-',ebn0db,pesystem,'r+-')
xlabel('E_b/N_0(dB)');ylabel('Probability of Error');grid
axis([0 14 10^(-10) 1])
%END of script file
        

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -