【数字通信】Matlab实现16QAM调制与解调,判决,误码率计算
【数字通信】Matlab实现16QAM调制与解调,判决,误码率计算
TT_Matlab
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,完整matlab代码或者程序定制加qq1575304183。
1 简介
多进制正交幅度调制,结合了幅度和相位两个要素,信号均匀分布,频谱利用率高.文中介绍了正交幅度调制解调原理,通过系统仿真实验,对16QAM的调制解调过程,原理进行了论证分析,给出了高斯白噪声干扰下的误码率.仿真实验结果说明了,多进制正交幅度调制解调功率,带宽高效,易于实现,误码率低,抗干扰能力强.
2 部分代码
clc;
clear;
%% 长度N(
1
-1
)比特序列产生
N =
4e4
; %设置比特序列的长度
t =
1
:
1
:N;
data = randi(
2
,
1
,N)
-1
;
% data = [
1
1
0
1
0
0
1
1
1
1
0
1
0
0
1
1
0
1
1
1
];
figure(
1
)
plot(data(
1
:
40
),
’*’
)
axis([
0
41
-0.2
1.2
])
title(
’图1 原始数据序列’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
grid
on
;
%%
16
QAM调制
data_modu = QAM16_modu( data );
figure(
2
)
subplot(
2
,
1
,
1
)
plot(real(data_modu(
1
:
10
)),
’*’
);
title(
’图2-1 16QAM调制数据的实部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
axis([
0
11
-4
4
]);
grid
on
;
subplot(
2
,
1
,
2
)
plot(imag(data_modu(
1
:
10
)),
’*’
)
title(
’图2-2 16QAM调制数据的虚部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
axis([
0
11
-4
4
]);
grid
on
;
%%
8
倍插值
data_upsam = upsample(data_modu,
8
);
figure(
3
)
subplot(
2
,
1
,
1
);
plot(real(data_upsam(
1
:
80
)),
’*’
);
title(
’图3-1 16QAM调制数据8倍插值后的实部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
axis([
0
81
-4
4
]);
grid
on
;
subplot(
2
,
1
,
2
);
plot(imag(data_upsam(
1
:
80
)),
’*’
)
title(
’图3-2 16QAM调制数据8倍插值后的虚部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
axis([
0
81
-4
4
]);
grid
on
;
%% 设置均方根升余弦滤波器的参数
beta =
0.25
;
span =
6
;
sps =
4
;
b = rcosdesign(beta, span, sps,
’sqrt’
);
%% 发射端均方根成型滤波——低通滤波
data_low1 = conv(data_upsam, b);
figure(
4
)
subplot(
2
,
1
,
1
)
% span*sps/
2
+
1
data_low1(
1
:
80
)
plot(real(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
title(
’图4-1 发射端低通滤波后的实部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
% axis([span*sps/
2
+
1
span*sps/
2
+
80
-2
2
]);
grid
on
;
subplot(
2
,
1
,
2
)
plot(imag(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
)
title(
’图4-2 发射端低通滤波后的虚部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
% axis([span*sps/
2
+
1
span*sps/
2
+
80
-2
2
]);
grid
on
;
%% 信道加性高斯白噪声
%SNR与EbN0之间的关系SNR = EbN0 +
10l
og10(NBits * Coderate) -
10l
og10(
0.5
or1 * upfactor)
BER = zeros(
1
,
15
);
NBits =
4
;
Coderate =
1
;
upfactor =
8
;
%
for
EbN0 =
1
:
1
:
15
EbN0 =
10
;
SNR = EbN0 +
10
*log10(NBits * Coderate) -
10
*log10(
1
* upfactor);
data_awgn = awgn(data_low1,SNR,
’measured’
);
figure(
5
)
subplot(
2
,
1
,
1
)
plot(real(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
hold
on
;
plot(real(data_awgn((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
title(
’图5-1 加噪声前后数据的实部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
legend(
’噪声前’
,
’噪声后’
);
% axis([span*sps/
2
+
1
span*sps/
2
+
80
-4
4
]);
grid
on
;
subplot(
2
,
1
,
2
)
plot(imag(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
hold
on
;
plot(imag(data_awgn((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
title(
’图5-2 加噪声前后数据的虚部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
legend(
’噪声前’
,
’噪声后’
);
% axis([span*sps/
2
+
1
span*sps/
2
+
80
-4
4
]);
grid
on
;
%% 接收端均方根滤波——低通滤波
data_low2 = conv(data_awgn, b);
% data_low2 = conv(data_low1, b);
data_window = data_low2( (span*sps+
1
):(span*sps+length(data_upsam)) );
figure(
6
)
subplot(
2
,
1
,
1
)
plot(real(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
hold
on
;
plot(real(data_awgn((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
plot(real(data_window(
1
:
80
)),
’LineWidth’
,
1
);
title(
’图6-1 加噪声及滤波前后数据的实部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
legend(
’噪声前’
,
’噪声后’
,
’滤波后’
);
grid
on
;
subplot(
2
,
1
,
2
)
plot(imag(data_low1((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
hold
on
;
plot(imag(data_awgn((span*sps/
2
+
1
):(span*sps/
2
+
80
))),
’LineWidth’
,
1
);
plot(imag(data_window(
1
:
80
)),
’LineWidth’
,
1
);
title(
’图6-2 加噪声及滤波前后数据的虚部’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
legend(
’噪声前’
,
’噪声后’
,
’滤波后’
);
grid
on
;
%%
1
/
8
倍采样
data_downsam = downsample(data_window,
8
,
0
);
figure(
7
)
subplot(
4
,
1
,
1
);
[
f2,xi2
] = ksdensity(real(data_modu)); %发射信号实部的
PDF
plot
(
xi2,f2
)
;
title(
’发射端16QAM调制之后信号实部的pdf’
);
axis([
-5
5
0
0.3
])
grid
on
;
subplot(
4
,
1
,
2
);
[
f22,xi22
] = ksdensity(imag(data_modu)); %发射信号实部的
PDF
plot
(
xi22,f22
)
;
title(
’发射端16QAM调制之后信号虚部的pdf’
);
axis([
-5
5
0
0.3
])
grid
on
;
subplot(
4
,
1
,
3
)
[
f7,xi7
] = ksdensity(real(data_downsam)); %接收信号实部的
PDF
plot
(
xi7,f7
)
;
title(
’接收端下采样之后信号实部的pdf’
);
axis([
-5
5
0
0.3
])
grid
on
;
subplot(
4
,
1
,
4
)
[
f72,xi72
] = ksdensity(imag(data_downsam)); %接收信号虚部的
PDF
plot
(
xi72,f72
)
;
title(
’接收端下采样之后信号虚部的pdf’
);
axis([
-5
5
0
0.3
])
grid
on
;
%%
16
QAM星座点判决
data_Judge = QAM16_Euclid_Judge( data_downsam );
%%
16
QAM解调
data_demodu = QAM16_demodu( data_Judge );
figure(
8
)
subplot(
2
,
1
,
1
)
plot(data(
1
:
40
),
’*’
);
axis([
0
41
-0.2
1.2
])
title(
’图8-1 原始数据序列’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
grid
on
;
subplot(
2
,
1
,
2
)
plot(data_demodu(
1
:
40
),
’*’
);
axis([
0
41
-0.2
1.2
])
title(
’图8-2 接收数据序列’
);
xlabel(
’t’
);
ylabel(
’数据值’
);
grid
on
;
% %% 解调数据与原始数据比较并计算误码率
% n = length(find(data_demodu-data));
% BER(EbN0) = n/N
% end
% %% 求得理论误比特率
% EbN0 =
1
:
1
:
15
% BER0 = berawgn(EbN0,
’qam’
,
16
);
%
% %% 理论误比特率与仿真误比特率的比较
% figure(
9
)
% semilogy(EbN0,BER,
’-o’
,
’LineWidth’
,
1
);
% hold
on
;
% semilogy(EbN0,BER0,
’-o’
,
’LineWidth’
,
1
);
% xlabel(
’EbN0 / dB’
);
% ylabel(
’BER’
);
% title(
’图9 理论误比特率与仿真误比特率的比较’
)
% legend(
’实际BER’
,
’理论BER’
);
% grid
on
;
3 仿真结果
4 参考文献
[1]丁业兵, 王子武, 谭学琴. 16QAM通信系统的MATLAB实现[J]. 微型电脑应用, 2017, 33(2):3.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
5 代码下载
-
2023年血糖新标准公布,不是3.9-6.1,快来看看你的血糖正常吗? 2023-02-07
-
2023年各省最新电价一览!8省中午执行谷段电价! 2023-01-03
-
GB 55009-2021《燃气工程项目规范》(含条文说明),2022年1月1日起实施 2021-11-07
-
PPT导出高分辨率图片的四种方法 2022-09-22
-
2023年最新!国家电网27家省级电力公司负责人大盘点 2023-03-14
-
全国消防救援总队主官及简历(2023.2) 2023-02-10
-
盘点 l 中国石油大庆油田现任领导班子 2023-02-28
-
我们的前辈!历届全国工程勘察设计大师完整名单! 2022-11-18
-
关于某送变电公司“4·22”人身死亡事故的快报 2022-04-26
