多径信道误码率理论仿真
global dt t df N
close all
N=2^10; %采样点数
L=64; %每码元的采样点数
M=N/L; %码元数
Rb=2; %码速率是2Mb/s , 码速率单位是Mb/s
Ts=1/Rb; %码元间隔
dt=Ts/L; %时域采样间隔 , 时间单位是微秒
df=1/(N*dt) %频域采样间隔 ,频率单位为MHz
T=N*dt; %截短时间
Bs=N*df/2; %系统带宽
Na=4; %示波器扫描宽度为4个码元
alpha=0.5;
db=input('眼图的信噪比db=');
if db==[]|db>15|db<0
db=15;
end;
b=0;
a=.5;
to=.5;
phi=0;
t=linspace(-T/2,T/2,N);
f=linspace(-Bs,Bs,N)+eps;
hr1=sin(pi*t/Ts)./(pi*t/Ts);
hr2=cos(alpha*pi*t/Ts)./(1-(2*alpha*t/Ts).^2);
hr=hr1.*hr2;
HR=abs(t2f(hr));
GT=sqrt(HR);
GR=GT;
C=1-a*exp(-j*(2*pi*f*to*Ts+phi));
H=C.*HR;
h=real(f2t(H));
for loop1=1:16
Eb_N0(loop1)=(loop1-1);
eb_n0(loop1)=10^(Eb_N0(loop1)/10);
Eb=1;
n0=Eb/eb_n0(loop1);
sita=n0*Bs;
n_err1=0;
n_err2=0;
for loop2=1:600
a=abs(sign(randn(1,M)));
imp=zeros(1,N);
imp(L/2:L:N)=a/dt;
IMP=t2f(imp);
n_ch=sqrt(sita)*randn(size(t));
nr=real(f2t(t2f(n_ch).*GR));
sr1=real(f2t(IMP.*HR))+nr;
sr2=real(f2t(IMP.*H))+nr;
y1=sign(sr1(L*(.5+b):L:N));
y2=sign(sr2(L*(.5+b):L:N));
n_err1=n_err1+length(find(y1~=a));
n_err2=n_err2+length(find(y2~=a));
end
Pe2(loop1)=n_err2/(M*loop2);
Pe1(loop1)=n_err1/(M*loop2);
eb_n0=10.^(Eb_N0/10);
figure(1)
semilogy(Eb_N0,0.5*erfc(sqrt(eb_n0)),'r');
hold on;
semilogy(Eb_N0,Pe1+eps,'k');
hold on;
semilogy(Eb_N0,Pe2+eps,'b');
axis([0,13,1e-6,1]);
legend('理想曲线','普通加性高斯白噪声信道','多径信道');
title(['取样时间偏差为0']);
end
xlabel('Eb/N0')
ylabel('Pe')
免责声明:本文系网络转载或改编,未找到原创作者,版权归原作者所有。如涉及版权,请联系删