1、前置说明
- 基于AWGN信道
- 硬判决,格雷码,STBC空时分组码
- 使用了Matlab通信工具箱,需要对应Matlab版本支持
- 源码文件:
QPSK 调制在高斯信道下的性能
16QAM 与 QPSK 在 AWGN 信道下的对比
2X1 MISO 2x2 MIMO 在 STBC QPSK下的 误码率
2、仿真结果
- QPSK硬判决仿真值曲线与理论值曲线几乎完全吻合,仿真正确。
- 其它条件一致时,QPSK较16QAM的BER性能好
7dB
。 - 其它条件一致时,信道系数均设为1时,2x1 MISO与SISO 条件下的QPSK硬判决性能相当。
- 其它条件一致时,信道系数均设为1时,2x2 MIMO较SISO 条件下的QPSK硬判决性能有
3dB
增益。
(1)MISO信噪比增益: 1 N T ⋅ Σ i = 1 N T ∣ h i ∣ 2 \displaystyle \frac{1}{N_T}\cdot\Sigma_{i=1}^{N_T}|h_i|^2 NT1⋅Σi=1NT∣hi∣2。
(2)MIMO信道容量:1、已知信道状态信息时: 子信道个数 L L L= m i n ( N T , N R ) min(N_T,N_R) min(NT,NR),信道容量 C = W ⋅ Σ i = 1 L l o g 2 ( 1 + P L i σ 2 ) \displaystyle C=W\cdot\Sigma_{i=1}^Llog_2\left(1+\frac{P_{L_i}}{\sigma^2}\right) C=W⋅Σi=1Llog2(1+σ2PLi)(未知信道状态信息 C S I CSI CSI), P L i = λ i P T N T \displaystyle P_{L_i}=\frac{\lambda_iP_T}{N_T} PLi=NTλiPT。
2、已知信道信息: C = Σ i = 1 L l o g 2 ( 1 + 1 σ 2 ( λ i μ − σ 2 ) ) \displaystyle C=\Sigma_{i=1}^Llog_2\left(1+\frac{1}{\sigma^2}(\lambda_i\mu-\sigma^2)\right) C=Σi=1Llog2(1+σ21(λiμ−σ2))。P i = m a x ( μ − σ 2 λ i , 0 ) ( i = 1 , 2 , . . . , L ) P_i=max\left(\mu-\frac{\sigma^2}{\lambda_i},0\right)(i=1,2,...,L) Pi=max(μ−λiσ2,0)(i=1,2,...,L), μ \mu μ 满足 Σ i = 1 L P i = P T \Sigma_{i=1}^LP_i=P_T Σi=1LPi=PT
N T 与 N R N_T与N_R NT与NR分别表示发射天线数与接收天线数, h i h_i hi表示路径衰落; P L i P_{Li} PLi为第 i i i个子信道接收信号功率, σ 2 为 噪 声 功 率 \sigma^2为噪声功率 σ2为噪声功率, λ i \sqrt{\lambda_i} λi为信道矩阵奇异值, P T P_T PT为发射信号总功率。
3、Matlab仿真源代码
- QPSK
%% QPSK
clear all;
clc;
theory = 0;
%SymbolMapping_ = 'Binary';
SymbolMapping_ = 'Gray'; %使用格雷码
qpsk_mo = comm.QPSKModulator('SymbolMapping',SymbolMapping_,...
'BitInput',true ); %Binary | Gray %比特流输入
qpsk_demo = comm.QPSKDemodulator('SymbolMapping',SymbolMapping_,...
'BitOutput',true); %比特流输出
snr = -5:1:15; %仿真信噪比
bit_number = 10^7; %仿真比特数
for i = 1:length(snr)
if( i == 1)
tic;
end
bit_in = randi([0 1],1,bit_number).';
bit_channel = qpsk_mo(bit_in);%归一化输出
bit_channel_awgn = awgn(bit_channel,snr(i));
%scatterplot(bit_channel_awgn); %查看调制星座图
bit_out = qpsk_demo(bit_channel_awgn);
Totalerror_bit = length(find(bit_in ~= bit_out));
if i==1
p_bit = zeros(1,length(snr));
end
p_bit(i) = Totalerror_bit/length(bit_in);
clear bit_in bit_out bit_channel_awgn bit_channel;
fprintf('%d\n',i);
toc;
end
Pb_theory = 0.5* erfc(sqrt(10.^(snr/10)/2));
semilogy(snr,p_bit,'ks-',snr,Pb_theory,'k*-');
legend('误比特率','理论误比特率');
title(['AWGN QPSK 硬判决' ' ' SymbolMapping_ ]);
grid on;
xlabel('SNR');ylabel('BER');
- 16QAM
%% 16QAM
clear all;
clc;
qam_16_1 = sqrt(10); %能量归一化因子
Constellation_ = [-3-3j -3-1j -3+1j -3+3j -1-3j -1-1j -1+1j -1+3j 1-3j 1-1j 1+1j 1+3j 3-3j 3-1j 3+1j 3+3j]./qam_16_1;
%16QAM星座图
QAMMod = comm.GeneralQAMModulator('Constellation',Constellation_);
QAMDeMod = comm.GeneralQAMDemodulator('Constellation',Constellation_ ,...
'BitOutput',true,...
'DecisionMethod','Hard decision');
snr = -5:1:15;
bit_number_ = 10^7;
dec_number = bit_number_/4;
for i = 1:length(snr)
if( i == 1)
tic;
end
dec_in = randi([0 15],1,dec_number).';
bit_in = dec4_to_bin(dec_in);
dec_channel = QAMMod(dec_in);%归一化输出
%scatterplot(dec_channel);
bit_channel_awgn = awgn(dec_channel,snr(i));
bit_out = QAMDeMod(bit_channel_awgn).';
Totalerror_bit = length(find(bit_in ~= bit_out));
if i==1
p_bit = zeros(1,length(snr));
end
p_bit(i) = Totalerror_bit/numel(bit_in);
clear dec_in bit_in bit_out bit_channel_awgn dec_channel;
fprintf('%d\n',i);
toc;
end
semilogy(snr,p_bit,'ks-');
title(['AWGN 16QAM 硬判决']);
grid on;hold on;
xlabel('SNR');ylabel('BER');
下面为一个转换函数
function bitout = dec4_to_bin(decin)
bitout = zeros(numel(decin),4);
for i = 1:length(decin)
switch decin(i)
case 0
bitout(i,1) = 0;
bitout(i,2) = 0;
bitout(i,3) = 0;
bitout(i,4) = 0;
case 1
bitout(i,1) = 0;
bitout(i,2) = 0;
bitout(i,3) = 0;
bitout(i,4) = 1;
case 2
bitout(i,1) = 0;
bitout(i,2) = 0;
bitout(i,3) = 1;
bitout(i,4) = 0;
case 3
bitout(i,1) = 0;
bitout(i,2) = 0;
bitout(i,3) = 1;
bitout(i,4) = 1;
case 4
bitout(i,1) = 0;
bitout(i,2) = 1;
bitout(i,3) = 0;
bitout(i,4) = 0;
case 5
bitout(i,1) = 0;
bitout(i,2) = 1;
bitout(i,3) = 0;
bitout(i,4) = 1;
case 6
bitout(i,1) = 0;
bitout(i,2) = 1;
bitout(i,3) = 1;
bitout(i,4) = 0;
case 7
bitout(i,1) = 0;
bitout(i,2) = 1;
bitout(i,3) = 1;
bitout(i,4) = 1;
case 8
bitout(i,1) = 1;
bitout(i,2) = 0;
bitout(i,3) = 0;
bitout(i,4) = 0;
case 9
bitout(i,1) = 1;
bitout(i,2) = 0;
bitout(i,3) = 0;
bitout(i,4) = 1;
case 10
bitout(i,1) = 1;
bitout(i,2) = 0;
bitout(i,3) = 1;
bitout(i,4) = 0;
case 11
bitout(i,1) = 1;
bitout(i,2) = 0;
bitout(i,3) = 1;
bitout(i,4) = 1;
case 12
bitout(i,1) = 1;
bitout(i,2) = 1;
bitout(i,3) = 0;
bitout(i,4) = 0;
case 13
bitout(i,1) = 1;
bitout(i,2) = 1;
bitout(i,3) = 0;
bitout(i,4) = 1;
case 14
bitout(i,1) = 1;
bitout(i,2) = 1;
bitout(i,3) = 1;
bitout(i,4) = 0;
case 15
bitout(i,1) = 1;
bitout(i,2) = 1;
bitout(i,3) = 1;
bitout(i,4) = 1;
end
end
bitout = reshape(bitout.',1,numel(bitout));
end
也可使用下列转换函数,比较简练,但运行速度较慢
function bitout = dec4_to_bin(decin)
bitout = zeros(numel(decin),4);
%% dec2bin
for i = 1:length(decin)
bitout(i,:) = dec2bin(decin(i),4);
end
bitout = reshape((bitout-48).',1,numel(bitout)); %Ascii码转换
end
- MISO(两条径衰落一致)
%% MISO QPSK
clc;
clear all;
%SymbolMapping_ = 'Binary';
SymbolMapping_ = 'Gray';
qpsk_mo = comm.QPSKModulator('SymbolMapping',SymbolMapping_,...
'BitInput',true );
qpsk_demo = comm.QPSKDemodulator('SymbolMapping',SymbolMapping_,...
'BitOutput',true);
SNR_dB=-5:1:15;
bit_number = 10^6;
Frame=bit_number/4;
tic;
for i=1:length(SNR_dB)
ErrorNum=0;
for j =1:1:Frame
bit_in = randi([0 1],1,4).';
bit_channel = qpsk_mo(bit_in);%归一化输出
x1 = bit_channel(1);
x2 = bit_channel(2);
%---------------------------进行空时编码---------------------------------
X_1 = [x1 -conj(x2)];
X_2 = [x2 conj(x1)];
X_1_channel = awgn(X_1,SNR_dB(i));
X_2_channel = awgn(X_2,SNR_dB(i));
R = X_1_channel + X_2_channel; % R(1)=x1+x2 R(2)=(-conj(x2))+conj(x1)
%---------------------------进行空时解码--------------------------------
% A=h1*conj(h1)+h2*conj(h2);
% X1=(conj(h1)*R(1)+h2*conj(R(2)))/A;
% X2=(conj(h2)*R(1)-h1*conj(R(2)))/A;
X1=(R(1)+conj(R(2)))/2;
X2=(R(1)-conj(R(2)))/2;
bit_channel_awgn = [X1 X2].';
bit_out = qpsk_demo(bit_channel_awgn);
ErrorNum=ErrorNum+length(find(bit_in ~= bit_out));
end
fprintf('%d\n',i);
toc;
P(i)=ErrorNum/(Frame*4);
end
semilogy(SNR_dB,P,'k+-');
title(['AWGN 2*1-MISO-QPSK 硬判决' ' ' 'Gray']);
grid on;
xlabel('SNR');ylabel('BER');
- MIMO(两条径衰落一致)
%% MIMO QPSK
clc;
clear all;
%SymbolMapping_ = 'Binary';
SymbolMapping_ = 'Gray';
qpsk_mo = comm.QPSKModulator('SymbolMapping',SymbolMapping_,...
'BitInput',true );
qpsk_demo = comm.QPSKDemodulator('SymbolMapping',SymbolMapping_,...
'BitOutput',true);
SNR_dB=-5:1:15;
bit_number = 10^6;
Frame=bit_number/4;
tic;
for i=1:length(SNR_dB)
ErrorNum=0;
for j =1:1:Frame
bit_in = randi([0 1],1,4).';
bit_channel = qpsk_mo(bit_in);%归一化输出
x1 = bit_channel(1);
x2 = bit_channel(2);
%---------------------------进行空时编码---------------------------------
X_1 = [x1 -conj(x2)];
X_2 = [x2 conj(x1)];
X_1_channel = awgn(X_1,SNR_dB(i));
X_2_channel = awgn(X_2,SNR_dB(i));
X1_1_channel = awgn(X_1,SNR_dB(i));
X1_2_channel = awgn(X_2,SNR_dB(i));
R1 = X_1_channel + X_2_channel; % R(1)=x1+x2 R(2)=(-conj(x2))+conj(x1)
R2 = X1_1_channel + X1_2_channel;
%---------------------------进行空时解码--------------------------------
% A=h1*conj(h1)+h2*conj(h2);
% X1=(conj(h1)*R(1)+h2*conj(R(2)))/A;
% X2=(conj(h2)*R(1)-h1*conj(R(2)))/A;
X11=(R1(1)+conj(R1(2)))/2;
X21=(R1(1)-conj(R1(2)))/2;
bit_channel_awgn1 = [X11 X21].';
X12=(R2(1)+conj(R2(2)))/2;
X22=(R2(1)-conj(R2(2)))/2;
bit_channel_awgn2 = [X12 X22].';
bit_channel_awgn = (bit_channel_awgn1 + bit_channel_awgn2)/2;
bit_out = qpsk_demo(bit_channel_awgn);
ErrorNum=ErrorNum+length(find(bit_in ~= bit_out));
end
fprintf('%d\n',i);
toc;
P(i)=ErrorNum/(Frame*4);
end
semilogy(SNR_dB,P,'k+-');
title(['AWGN 2*1-MISO-QPSK 硬判决' ' ' 'Gray' ' ' num2str(4*Frame/10^6) 'Mbit']);
grid on;
xlabel('SNR');ylabel('BER');