当前位置:网站首页>Baseband simulation system experiment of 4pam in Gaussian channel and Rayleigh channel
Baseband simulation system experiment of 4pam in Gaussian channel and Rayleigh channel
2022-07-25 15:47:00 【Machitangtang】
1、 System diagram

2、 Code
clear all
close all
clc
N = 10000; % Number of bits
SNR=0:10; %SNR The scope of the
EbN0 = 10.^(SNR/10);
err_num=zeros(1,length(SNR)); % error bit Number
simu_ber = zeros(1,length(SNR)); % Simulation bit error rate
theory_berAWGN = zeros(1,length(SNR)); % Theoretical bit error rate
theroy_berRaliy = zeros(1,length(SNR)); % Theoretical bit error rate
R=raylrnd(0.5,1,N); % Generate Rayleigh signal
M = 4;% Hexadecimal number
graycode = [0,1,2,3];% gray mapping
send_bit = randsrc(1,N,[0:3]);
send_bit2 = graycode(send_bit+1); % Gray code
send_bit3 = pammod(send_bit2,M);%PAM modulation
msg_tx = real(send_bit3);
hR = send_bit3.*R; % Rayleigh distribution
pow_msg=norm(msg_tx)^2/length(msg_tx); % Signal symbol power Es
for k=1:length(SNR)
sigma=sqrt(pow_msg/(2*10^(SNR(k)/10))); % Noise variance
msg_rx_awgn=msg_tx+sigma*randn(1,N);% adopt AWGN channel
msg_rx_raily=awgn(hR,SNR(k),'measured');
%4PAM demodulation
dePAM_awgn = pamdemod(msg_rx_awgn,M);%PAM demodulation
decPAM_awgn = graycode(dePAM_awgn+1);% demapping
dePAM_Raily = pamdemod(msg_rx_raily,M);
decPAM_Raily = graycode(dePAM_Raily+1);
[~,BER(k)] = biterr(send_bit, decPAM_awgn, log2(M)); % Calculation AWGN channel BER
[ ~,BER1(k)] =biterr(send_bit,decPAM_Raily,log2(M)); % Calculate Rayleigh fading +AWGN channel BER
[ ~,SER(k)] = symerr(send_bit, decPAM_awgn); % Calculation AWGN channel SER
[~,SER1(k)] = symerr(send_bit, decPAM_Raily); % Calculate Rayleigh fading +AWGN channel SER
theory_ser(k) = 1.5*qfunc(sqrt(0.4*EbN0(k))); % Theoretical symbol error rate
theory_ber(k) = (2*(M-1)/M)*qfunc(sqrt(6*EbN0(k)/(M^2-1)));% Theoretical bit error rate
end
figure
semilogy(SNR,BER,'-ro',SNR,SER,'-r*',SNR,BER1,'-b.',SNR,SER1,'-b^',SNR,theory_ser,'o-',SNR,theory_ber,'-sg') ; % Draw BER and SER along with SNR The curve of change
legend('AWGN channel BER','AWGN channel SER','Rayleigh Decline +AWGN channel BER','Rayleigh Decline +AWGN channel SER',' Theoretical symbol error rate ',' Theoretical bit error rate ');
title('4PAM stay AWGN and Rayleigh Performance in fading channels ');
xlabel(' Signal-to-noise ratio (dB)');
ylabel(' Symbol error rate and bit error rate ');
%% Draw a constellation
scatterplot(send_bit3);
title(' Modulation signal constellation ');
scatterplot(msg_rx_awgn);
title('AWGN Received signal constellation ');
scatterplot(msg_rx_raily);
title('Raily Received signal constellation ');3、 experimental result

边栏推荐
- 2021上海市赛-B-排序后dp
- How to disable hosting when Flink SQL in flink-1.13.6 runs in yarn session mode
- 2019 Zhejiang race c-wrong arrangement, greedy
- Leetcode - 232 realize queue with stack (design double stack to realize queue)
- Leetcode - 622 design cycle queue (Design)
- GAMES101复习:线性代数
- Pytoch learning notes - Teacher Liu Er RNN advanced chapter - code comments and results
- How to solve cross domain problems
- Week303 of leetcode
- Take you to learn more about JS basic grammar (recommended Collection)
猜你喜欢

Leetcode - 380 o (1) time to insert, delete and get random elements (design hash table + array)

Matlab simulation of BPSK modulation system (1)

HDD Hangzhou station · harmonyos technical experts share the features of Huawei deveco studio

Pytorch学习笔记--常用函数总结3

Phased summary of the research and development of the "library management system -" borrowing and returning "module

Redis distributed lock, it's really impossible without it

Google Blog: training general agents with multi game decision transformer

LeetCode - 359 日志速率限制器 (设计)

Solve the vender-base.66c6fc1c0b393478adf7.js:6 typeerror: cannot read property 'validate' of undefined problem

Why is preparestatement better and safer?
随机推荐
I want to ask whether the variable configuration function can only be used in SQL mode
Gary marcus: learning a language is more difficult than you think
PAT甲级1151 LCA in a Binary Tree (30 分)
JS URLEncode function
Pytoch framework exercise (based on kaggle Titanic competition)
P4552 differential
CVPR 2022 | in depth study of batch normalized estimation offset in network
HDD杭州站·HarmonyOS技术专家分享HUAWEI DevEco Studio特色功能
Pat grade a 1153 decode registration card of PAT (25 points)
Get the ask code corresponding to the key pressed by the keyboard
Solve the vender-base.66c6fc1c0b393478adf7.js:6 typeerror: cannot read property 'validate' of undefined problem
LeetCode - 379 电话目录管理系统(设计)
2019 Zhejiang race c-wrong arrangement, greedy
LeetCode - 707 设计链表 (设计)
Flink-1.13.6版本的 Flink sql以yarn session 模式运行,怎么禁用托管
十字链表的存储结构
Google Blog: training general agents with multi game decision transformer
Pytoch learning notes -- Summary of common functions 2
Is there only one lib under JDBC in Seata?
Cf750f1 thinking DP