信道带宽无限,发送滤波器波形可以选择矩形波;信号波形选择为单极性不归零码。
s i ( t ) = { A , i = 1 0 , i = 2 s_i(t)= \begin{cases} A, & {i=1} \\ 0, & {i=2} \end{cases} si(t)={A,0,i=1i=2
r i ( t ) = s i ( t ) + n w ( t ) r_i(t)=s_i(t)+n_w(t) ri(t)=si(t)+nw(t)
假设发射的是$s_1(t) , 则 匹 配 滤 波 器 的 冲 击 响 应 为 ,则匹配滤波器的冲击响应为 ,则匹配滤波器的冲击响应为h(t)=s_1(T_b-t) 与 与 与s_1(t)$相匹配
r 1 ( t ) = s 1 ( t ) + n w ( t ) (2.1.1) r_1(t)=s_1(t)+n_w(t)\tag{2.1.1} r1(t)=s1(t)+nw(t)(2.1.1)
通过匹配滤波器之后
y 1 ( t ) = ∫ 0 t r ( τ ) ⋅ h ( t − τ ) d τ = ∫ 0 t s 1 2 ( τ ) d τ + ∫ 0 t n w ( τ ) ⋅ s 1 ( τ ) d τ (2.1.2) y_1(t)=\int_0^t {r(\tau)\cdot h(t-\tau)} \,{\rm d}\tau=\int_0^t {s_1^2(\tau)} \,{\rm d}\tau+\int_0^t n_w(\tau)\cdot{s_1(\tau)} \,{\rm d}\tau\tag{2.1.2} y1(t)=∫0tr(τ)⋅h(t−τ)dτ=∫0ts12(τ)dτ+∫0tnw(τ)⋅s1(τ)dτ(2.1.2)
在 T b T_b Tb时刻的采样值为
y 1 ( T b ) = ∫ 0 T b s 1 2 ( t ) d t + ∫ 0 T b n w ( t ) ⋅ s 1 ( t ) d t (2.1.3) y_1(T_b)=\int_0^{T_b} {s_1^2(t)} \,{\rm d}t+\int_0^{T_b} n_w(t)\cdot{s_1(t)} \,{\rm d}t\tag{2.1.3} y1(Tb)=∫0Tbs12(t)dt+∫0Tbnw(t)⋅s1(t)dt(2.1.3)
画出概率密度函数图
y 1 ( t ) y_1(t) y1(t)均值为 E b E_b Eb,方差为 N 0 E 1 2 \frac {N_0E_1} {2} 2N0E1
y 2 ( t ) y_2(t) y2(t)均值为0,方差为 N 0 E 1 2 \frac {N_0E_1} {2} 2N0E1
判决门限 V T V_T VT为 E 1 2 \frac {E_1} {2} 2E1,系统的平均误码率为 E b = E 1 2 (2.1.4) E_b=\frac {E_1} {2}\qquad \tag{2.1.4} Eb=2E1(2.1.4) p e = Q ( E b N 0 E 1 2 ) = Q ( E b N 0 ) (2.1.5) p_e=Q({\frac {E_b} {\sqrt \frac {N_0E_1} {2}}})=Q(\sqrt {\frac {E_b} {N_0}})\tag{2.1.5} pe=Q(2N0E1Eb)=Q(N0Eb)(2.1.5)
信道带宽受限时,发送滤波器应为基于无码间干扰基带传输的升余弦滤波器。双极性序列: a i = { A , i = 1 − A , i = 2 a_i= \begin{cases} A, & {i=1} \\ -A, & {i=2} \end{cases} ai={A,−A,i=1i=2
该滤波器的带宽为 B = 1 + α 2 r s B=\frac {1+\alpha} {2}r_s B=21+αrs
其信号接收模型和信道带宽无限时的单极性基带传输的相同
该系统的传输与上一种系统的类似,不过发送滤波器发生了改变
r ( t ) = s i ( t ) + n w ( t ) r(t)=s_i(t)+n_w(t) r(t)=si(t)+nw(t),通过匹配滤波器之后:
y 1 ( t ) y_1(t) y1(t)均值为 E b E_b Eb,方差为 N 0 E b 2 \frac {N_0E_b} {2} 2N0Eb
y 2 ( t ) y_2(t) y2(t)均值为 − E b -E_b −Eb,方差为 N 0 E b 2 \frac {N_0E_b} {2} 2N0Eb
此时的判决门限变为 V T = 0 V_T=0 VT=0,平均误码率为 E b = E 1 (2.2.1) E_b=E_1\qquad \tag{2.2.1} Eb=E1(2.2.1) p e = Q ( E b N 0 E 1 2 ) = Q ( 2 E b N 0 ) (2.2.2) p_e=Q({\frac {E_b} {\sqrt \frac {N_0E_1} {2}}})=Q(\sqrt {\frac {2E_b} {N_0}})\tag{2.2.2} pe=Q(2N0E1Eb)=Q(N02Eb)(2.2.2)
信道带宽受限,发送滤波器仍然选择升余弦滤波器
QPSK称作四进制移相键控,该信号的正弦波有4个可能的离散相位状态,每个载波相位携带两个二进制符号,其信号表达式为 s i ( t ) = A c o s ( w c t + θ i ) i = 1 , 2 , 3 , 4 s_i(t)=Acos(w_ct+\theta _i) \qquad i=1,2,3,4 si(t)=Acos(wct+θi)i=1,2,3,4
图中显示了两种离散相位的选择
进一步将 s i ( t ) s_i(t) si(t)写为 s i ( t ) = A 2 [ I ( t ) c o s w c t − Q ( t ) s i n w c t ] s_i(t)=\frac {A} {\sqrt{2}}[I(t)cosw_ct-Q(t)sinw_ct] si(t)=2A[I(t)coswct−Q(t)sinwct],其中 I ( t ) = ± 1 , Q ( t ) = ± 1 I(t)=\pm1,Q(t)=\pm1 I(t)=±1,Q(t)=±1
他的发送模型为(相位选择 π 4 \frac { \pi}{4} 4π)
对于QPSK而言,在QPSK与2PSK的输入二进制信息速率相同,二者的发送功率相同,加性噪声的单边功率谱密度 N 0 N_0 N0相同的情况下,QPSK与2PSK的平均误比特率是相同的 E b = E 1 (2.3.1) E_b=E_1\qquad \tag{2.3.1} Eb=E1(2.3.1) p e = Q ( E b N 0 E 1 2 ) = Q ( 2 E b N 0 ) (2.3.2) p_e=Q({\frac {E_b} {\sqrt \frac {N_0E_1} {2}}})=Q(\sqrt {\frac {2E_b} {N_0}})\tag{2.3.2} pe=Q(2N0E1Eb)=Q(N02Eb)(2.3.2)
带宽受限,发送滤波器仍然使用升余弦滤波器
16QAM是由两个正交载波的多电平振幅键控信号叠加而成的,它与MPSK的不同之处在于两个之路的多电平幅度序列是独立的
16QAM信号表示为 s Q A M ( t ) = a i c g T ( t ) c o s w c ( t ) + a i s g T ( t ) s i n w c ( t ) i = 1 , 2 , 3......16 (2.4.1) s_{QAM}(t)=a_{i_c}g_T(t)cosw_c(t)+a_{i_s}g_T(t)sinw_c(t)\qquad i=1,2,3......16\tag{2.4.1} sQAM(t)=aicgT(t)coswc(t)+aisgT(t)sinwc(t)i=1,2,3......16(2.4.1)
其中{ a i s a_{i_s} ais}、{ a i c a_{i_c} aic}是一组离散电平的集合, g T ( t ) g_T(t) gT(t)基带成形滤波器的冲激响应。
分析误码率时,可将两路4进制ASK分开计算。 P 4 P_4 P4表示4进制ASK支路的误码 P 4 = 3 4 [ 2 Q ( d m i n 2 2 N 0 ) ] (2.4.2) P_4=\frac{3}{4}[2Q(\sqrt {\frac {d^2_{min}} {2N_0}})]\tag{2.4.2} P4=43[2Q(2N0dmin2)](2.4.2)率。那么,16QAM的正确判决符号的概率为 P c = ( 1 − P 4 ) 2 (2.4.3) P_c=(1-P_4)^2\tag{2.4.3} Pc=(1−P4)2(2.4.3)从而推出 P e = 1 − P c = 2 P 4 − P 4 2 (2.4.4) P_e=1-P_c=2P_4-P^2_4\tag{2.4.4} Pe=1−Pc=2P4−P42(2.4.4)
源代码:
clear all
%------------------
%系统参数设置
%-----------------
T_start=0;%开始时间
T_stop=0.1;%截止时间
T=T_stop-T_start;%仿真持续时间
T_sample=1/1000;%采样间隔
f_sample=1/T_sample; % 采样速率
N_sample=T/T_sample;% 采样点数
n=0:N_sample-1;
r_s=100;%比特速率
alpha=0.25;%df=alpha*rs=25Hz
NumBits=T*r_s;%比特数
NumCoff=10;%number of coefficients of RRC
SamplingIns=NumCoff/2;
SamplingStart=NumCoff;
%-------------------------------
%发送波形
%-------------------------------
g_T=[ones(1,f_sample/r_s),0];
b1=(sign(rand(1,NumBits)-0.5)+1)/2;%原始序列
b2=zeros(f_sample/r_s,NumBits);
b2(1,:)=b1;
b3=reshape(b2,1,f_sample/r_s*NumBits);
s=conv(b3,g_T);%transmitted signal
%--------------------------------
%AWGN channel
%--------------------------------
N_0=10^(-8);
noise_w=wgn(1,length(s),N_0*f_sample,'linear');%产生白噪声
r=s+noise_w;
figure(1);
plot(r);
%--------------------------------
%receiver
%--------------------------------
g_R=g_T;
y1=conv(r,g_R);
figure;
myeyediagram=eyediagram(y1(1:length(y1)),f_sample/r_s);
figure(2)
plot(y1)
hold on
sample1=zeros(f_sample/r_s,NumBits);
sample1(1,:)=ones(1,NumBits);
sample2=reshape(sample1,1,f_sample/r_s*NumBits);
sample3=zeros(1,length(y1));
sample3(NumCoff+1:NumCoff+f_sample/r_s*NumBits)=sample2;
stem(sample3,'.');
y2=y1.*sample3;
stem(y2,'.')
y2(:,all(y2==0,1))=[];
b_t=b1;
b_r=(sign(y2-5)+1)*0.5;%滤波器的功率为N0=10,判决点位为N0/2=5
BER=length(find(b_t~= b_r))/NumBits;%求误码率
当高斯白噪声功率很小( n 0 = 1 0 − 8 n_0=10^{-8} n0=10−8)时,误码率也很小,模拟出来的误码率为0
将高斯白噪声的功率调大( n 0 = 1 0 − 3 n_0=10^{-3} n0=10−3)以后,误码率变大:
源代码:
clear all
%------------------
%系统参数设置
%-----------------
T_start=0;%开始时间
T_stop=1;%截止时间
T=T_stop-T_start;%仿真持续时间
T_sample=1/1000;%采样间隔
f_sample=1/T_sample; % 采样速率
N_sample=T/T_sample;% 采样点数
n=0:N_sample-1;
r_s=100;%比特速率
alpha=0.25;%df=alpha*rs=25Hz
NumBits=T*r_s;%比特数
NumCoff=80;%number of coefficients of RRC
SamplingIns=NumCoff/2;
SamplingStart=NumCoff;
%-------------------------------
%发送波形
%-------------------------------
% g_T=10*firrcos(NumCoff,r_s/2,alpha*r_s,f_sample);%发送滤波器
g_T=rcosdesign(alpha,8,10,'sqrt');
b1=sign(rand(1,NumBits)-0.5);%原始序列
b2=zeros(f_sample/r_s,NumBits);
b2(1,:)=b1;
b3=reshape(b2,1,f_sample/r_s*NumBits);
s=conv(b3,g_T);%transmitted signal
%--------------------------------
%AWGN channel
%--------------------------------
N_0=10^(-3);
noise_w=wgn(1,length(s),N_0*f_sample,'linear');%产生白噪声
r=s+noise_w;
figure(1);
plot(r);
%--------------------------------
%receiver
%--------------------------------
g_R=g_T;
y1=conv(r,g_R);
figure;
myeyediagram=eyediagram(y1(1:length(y1)),f_sample/r_s);
figure(2)
plot(y1)
hold on
sample1=zeros(f_sample/r_s,NumBits);
sample1(1,:)=ones(1,NumBits);
sample2=reshape(sample1,1,f_sample/r_s*NumBits);
sample3=zeros(1,length(y1));
sample3(NumCoff+1:NumCoff+f_sample/r_s*NumBits)=sample2;
%stem(sample3,'.');
y2=y1.*sample3;
stem(y2,'.');
y2(:,all(y2==0,1))=[];
b_t=b1;
b_r=sign(y2);%判决门限为0
BER=length(find(b_t~= b_r))/NumBits;
发送滤波器为
g_T=10*firrcos(NumCoff,r_s/2,alpha*r_s,f_sample);%发送滤波器
当高斯白噪声功率很小时( n 0 = 1 0 − 8 n_0=10^{-8} n0=10−8),误码率也很小,模拟出来的误码率为0
将高斯白噪声的功率调大( n 0 = 1 0 − 8 n_0=10^{-8} n0=10−8)以后,误码率变大:
源代码:
%信道带宽受限时的QPSK传输
clc;clear;
%%%%%%%%%%%%%%%%参数设置%%%%%%%%%%%%%%%%
fc = 5000000;
fs = 25000000;
N = 2000;
Tb = 1/5000000;
SNR=5;
%%%%%%%%%%%%%%%%发射机%%%%%%%%%%%%%%%%
data = round(rand(1,N));
%转为极性码
data_NRZ = 2*data-1;
%分为IQ两路
I = zeros(1,N);
Q = zeros(1,N);
I(1:2:N-1) = data_NRZ(1:2:N-1);
I(2:2:N) = data_NRZ(1:2:N-1);
Q(1:2:N-1) = data_NRZ(2:2:N);
Q(2:2:N) = data_NRZ(2:2:N);
%插0
zero = fs*Tb;
for i = 1:zero*N
if rem(i,zero)==1
I0(i) = I((i-1)/zero+1);
Q0(i) = Q((i-1)/zero+1);
else
I0(i) = 0;
Q0(i) = 0;
end
end
%%%%%%%%%%%%%%%%带宽无限AWGN信道%%%%%%%%%%%%%%%%
%平方根升余弦滤波器
NT=10; %滤波器阶数
rf=0.25; %滚降系数
B=(1+rf)/2.*(1/2.*Tb);%带宽
psf = rcosfir(rf,NT,zero,1/fs,'sqrt');
Ipulse = conv(I0,psf);
Qpulse = conv(Q0,psf);
%调制
num = NT*zero*2;
t = 0:1/fs:(N*zero+num)/fs-1/fs;
for i = 1:zero*N+num
Imod(i) = Ipulse(i)*sqrt(2)*cos(2*pi*fc*t(i));
Qmod(i) = Qpulse(i)*sqrt(2)*sin(2*pi*fc*t(i));
end
QPSK = Imod - Qmod;
%添加噪声
QPSK_in = awgn(QPSK,SNR,'measured');
%%%%%%%%%%%%%%%%接收机%%%%%%%%%%%%%%%%
%接收滤波器
[B,A] = butter(4,[0.08,0.8],'bandpass');
QPSK_in2=filter(B,A,QPSK_in);
%接收端,解调
for i = 1:zero*N+num
Idem(i)=QPSK_in2(i)*sqrt(2)*cos(2*pi*fc*t(i));
Qdem(i)=-QPSK_in2(i)*sqrt(2)*sin(2*pi*fc*t(i));
end
%低通滤波器
[B,A] = butter(4,0.95,'low');
Idem=filter(B,A,Idem);
Qdem=filter(B,A,Qdem);
%匹配滤波
mtf = rcosfir(rf,NT,zero,fs,'sqrt');
Idem2 = conv(Idem,mtf);
Qdem2 = conv(Qdem,mtf);
%数据选择
for i = 1:zero*N
Isel(i) = Idem2(i+num);
Qsel(i) = Qdem2(i+num);
end
%提取码元
for i = 1:N
I_sam(i) = Isel((i-1)*zero+1);
Q_sam(i) = Qsel((i-1)*zero+1);
end
%判决
threshold = 0.0;
for i = 1:N
if I_sam(i)>=threshold
I_final(i) = 1;
else
I_final(i) = -1;
end
if Q_sam(i)>=threshold
Q_final(i) = 1;
else
Q_final(i) = -1;
end
end
%并串变换
data_final(1:2:N-1) = I_final(1:2:N-1);
data_final(2:2:N) = Q_final(1:2:N-1);
N_0=1./(B.*SNR);
%理论计算的误码率
Pb=0.5*erfc(sqrt(1./abs(N_0)));
Pb=Pb(:,1);
%仿真误码率
ber=length(find(data_final~=data_NRZ))/N;
源代码(参考于网络):
M=16;
k=log2(M);
n=100000; %比特序列长度
samp=1; %过采样率
x=randint(n,1); %生成随机二进制比特流
stem(x(1:50),'filled'); %画出相应的二进制比特流信号
title('二进制随机比特流');
xlabel('比特序列');ylabel('信号幅度');
x4=reshape(x,k,length(x)/k);
xsym=bi2de(x4.','left-msb'); %将矩阵转化为相应的16进制信号序列
figure;
stem(xsym(1:50)); %画出相应的16进制信号序列
title('16进制随机信号');
xlabel('信号序列');ylabel('信号幅度');
y=modulate(modem.qammod(M),xsym); %16QAM调制器
scatterplot(y); %画出16QAM信号的星座图
text(real(y)+0.1,imag(y),dec2bin(xsym));
axis([-5 5 -5 5]);
EbNo=15;
snr=EbNo+10*log10(k)-10*log10(samp); %信噪比
yn=awgn(y,snr,'measured'); %加入高斯白噪声
h=scatterplot(yn,samp,0,'b.'); %经过信道后接收到的含白噪声的信号星座图
hold on;
scatterplot(y,1,0,'k+',h); %加入不含白噪声的信号星座图
title('接收信号星座图');
legend('含噪声接收信号','不含噪声信号');
axis([-5 5 -5 5]);
hold on;
eyediagram(yn,2); %眼图
yd=demodulate(modem.qamdemod(M),yn); %此时解调出来的是16进制信号
z=de2bi(yd,'left-msb'); %转化为对应的二进制比特流
z=reshape(z.',numel(z),1');
根据16QAM信号的星座图将二进制转换成十六进制:
信号的传输效率取决于信源编码、信道和判决方式,信道都是非理想的,经过信道后会对信号;产生不同程度上的干扰,从而引发失真。信源编码和信号采样判决方式可以一定程度上弥补这方面的误差,
本次实验结果显示,误码率最理想的是BPSK和QPSK,双极性码>单极性码。当在带宽有限的信道中传输时,需要选用根生余弦发送滤波器和接收滤波器来减少码间干扰达到最佳接收。若在理想无限带宽信道,我们可以选用方波来传送信号。对基带信道,一般用的较少,且其传送速率低于带通信道。