本文主要是介绍理想同步下正交幅度调制信号理论误码率统计,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
理想同步下QAM信号理论误码率统计
最近学习载波和符号同步,陆续做了些实验,针对每次实验的问题做做总结。
(一)仿真理想同步下QAM信号的传输,并统计误码率
clear;
% 产生随机信号,16QAM调制,过根升余弦得到发送信号,上变频,过接收滤波器,下变频,解调得到星座图
%% 参数设置
Symbol_Len = 100 * 10^3; % 生成符号数
RB = 10 * 10^3; % 符号速率
f = 400 * 10^3; % 采样速率
fc = 100 * 10^3; % 载波频率
nsamp = f / RB; % 每符号采样点数
len_point = nsamp * Symbol_Len; % 总采样点
%% 调制
Ms = 16;
Symbol_Ori = randi([0 Ms-1], 1, Symbol_Len); % 原始生成符号
Signal = qammod(Symbol_Ori, Ms); % 调制
% scatterplot(Signal)
% 产生根升余弦滤波器
alpha = 0.5; % 滚降系数
span = 20; % 滤波器占符号个数, span*nsamp 为滤波器总长度
h = rcosdesign(alpha, span, nsamp, 'sqrt'); % 产生根升余弦滤波器
% 正交调制
Signal_upsample_I = upsample(real(Signal), nsamp); % 正交调制,分IQ两路,上采样目的是为了与采样频率统一
SendSignal_I = conv(Signal_upsample_I, h); Signal_upsample_Q = upsample(imag(Signal), nsamp);
SendSignal_Q = conv(Signal_upsample_Q, h);% 观察基带信号
% pwelch(SendSignal_I + SendSignal_Q) % 大致信号带宽 5k
B = 5 * 10^3;%% 上变频
SendSignal_I_Up = SendSignal_I .* cos(2 * pi * fc * (0:length(SendSignal_I)-1) / f);
SendSignal_Q_Up = SendSignal_Q .* (-sin(2 * pi * fc * (0:length(SendSignal_Q)-1) / f));
SendSignal_Up = SendSignal_I_Up + SendSignal_Q_Up;
% pwelch(SendSignal_Up)%% 过awgn信道并接收
% SNR = (Eb/n0) * (Rb/B)
% = Eb/n0 + 10*log10(log2(Ms)) - 10*log10(nsamp); % 根据数字通信系统中 Eb/N0 与 SNR 转换方法的研究
EbN0 = 0:2:16;
% EbN0 = 30:2:40;
% 理论误比特率和误码率
% [ber, ser] = berawgn(EbN0, 'psk', Ms, 'nondiff');
[ber, ser] = berawgn(EbN0, 'qam', Ms);phase_est = zeros(1, length(EbN0));
for i = 1:length(EbN0)
% SNR = EbN0(i) + 10 * log10(RB * log2(Ms)) - 10 * log10(f/2);
SNR = EbN0(i) + 10 * log10(log2(Ms)) - 10 * log10(nsamp*0.5);
SendSignal_PassAwgn = awgn(SendSignal_Up, SNR, 'measured'); % 接收过带通滤波器
Hbandpassfilter = BandPassFilter; % 导入带通滤波器
Hbandpass = Hbandpassfilter.Numerator;ReceiveSignal = conv(SendSignal_PassAwgn, Hbandpass, 'same'); % 接收信号过带通滤波
% pwelch(ReceiveSignal)
% 下变频
ReceiveSignal_I_Down = 2 * ReceiveSignal .* cos(2 * pi * fc * (0:length(SendSignal_I)-1) / f);
ReceiveSignal_Q_Down = 2 * ReceiveSignal .* (-sin(2 * pi * fc * (0:length(SendSignal_Q)-1) / f));% 匹配滤波
Baseband_I = conv(ReceiveSignal_I_Down, h);
Baseband_Q = conv(ReceiveSignal_Q_Down, h);BasebandSignal = complex(Baseband_I, Baseband_Q);symb_soft = BasebandSignal(1 + span * nsamp: nsamp :end - span * nsamp); % 定时补偿后抽样
Symbol_ = qamdemod(symb_soft, Ms); % 判决[RBerr(i), RBrat(i)] = symerr(Symbol_Ori,Symbol_);
[Biterr(i), Bitrat(i)] = biterr(Symbol_Ori,Symbol_);
endber_num = round(ber * Symbol_Len * log2(Ms)); % 理论错误点数
ser_num = round(ser * Symbol_Len); % 理论错误符号数
%% 画统计误码率跟实际误码率
% figure
% % 理论误码率
% semilogy(EbN0, ser,'-*');hold on;
% % 实际误码率
% semilogy(EbN0, RBrat, '-o');
% legend('理论误码率','实际误码率')
% % xticklabels({'0','2','4','6','8','10','12','14','16'})
% xlabel('EbN0(dB)');
% ylabel('误码率SER');
% title('16QAM')
% % semilogy(RBrat - ser);figure
semilogy(EbN0, ber,'-*');hold on;
% 实际比特率
semilogy(EbN0, Bitrat, '-o');
legend('理论误比特率','实际误比特率')
% xticklabels({'0','2','4','6','8','10','12','14','16'})
xlabel('EbN0(dB)');
ylabel('误比特率BER');
title('16QAM')
带通滤波器(使用MATLAB自带Filter Designer设计)
function Hd = BandPassFilter
%BANDPASSFILTER 返回离散时间滤波器对象。% MATLAB Code
% Generated by MATLAB(R) 9.9 and DSP System Toolbox 9.11.
% Generated on: 25-Oct-2022 20:33:05% Equiripple Bandpass filter designed using the FIRPM function.% All frequency values are in kHz.
Fs = 400; % Sampling FrequencyFstop1 = 90; % First Stopband Frequency
Fpass1 = 95; % First Passband Frequency
Fpass2 = 105; % Second Passband Frequency
Fstop2 = 110; % Second Stopband Frequency
Dstop1 = 0.1; % First Stopband Attenuation
Dpass = 0.00057564620966; % Passband Ripple
Dstop2 = 0.1; % Second Stopband Attenuation
dens = 23; % Density Factor% Calculate the order from the parameters using FIRPMORD.
[N, Fo, Ao, W] = firpmord([Fstop1 Fpass1 Fpass2 Fstop2]/(Fs/2), [0 1 ...0], [Dstop1 Dpass Dstop2]);% Calculate the coefficients using the FIRPM function.
b = firpm(N, Fo, Ao, W, {dens});
Hd = dfilt.dffir(b);% [EOF]
实验结果
总结
- 关于 Eb/N0 的转换关系,主要参考论文 张少侃,吕聪敏,甘浩.数字通信系统中Eb/N0与SNR转换方法的研究[J].现代计算机,2019(12):33-36.
- 关于matlab自带卷积函数conv。实验因为这个conv出了不少问题,误码率一直没有贴近理论。如果使用 conv(xx,xx,‘same’),需要注意滤波器是否是奇数点,像本文图省事,滤波器都设计成奇数点,用’same’才对的;如果滤波器是偶数点,则应该conv之后手动对齐。
- 加噪与带通滤波。加噪应该可以通过awgn函数过高斯信道或者用rand产生噪声加到信号上。带通滤波图方便用的matlab自带的app,Filter Designer,图方便就容易出事:
一是没有留意把滤波器设计成奇对称,导致信号发生相偏;
二是点数应该设计成奇数点,方便卷积对齐;
三是通带增益Apass不知道为啥matlab不让设0,之前设为1就有问题,会导致信号功率放大,影响QAM解调性能,应该尽可能设小(本文设为0.01).
此外,还可以用低通滤波代替带通滤波。 - 关于根升余弦滤波器。如果在发送和接收使用 conv(xx,xx,‘same’),则会导致接收信号开头和结尾的能量减少,正确应该是卷积根升余弦滤波器后两侧不截断,下采样时注意对奇。
这篇关于理想同步下正交幅度调制信号理论误码率统计的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!