✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
🍎个人主页:Matlab科研工作室
🍊个人信条:格物致知。
⛄ 内容介绍
基于Matlab模拟噪声下 PPM 传输的仿真 附SER
⛄ 完整代码
% *************** Simulation SER of PPM transmission over noise **********%
% ********************* Initialization ***********************************%
clc;
clear all;
close all;
M=4; % bit resolution
Ns=1000; % number of PPM symbol
SNRdB=0:10; % SNR in dB
SNR=10.^(SNRdB/10);
Rate1= zeros(1, length(SNRdB)); %
Rate2= zeros(1, length(SNRdB)); %
% ********************* Transmitter **************************************%
for dB= 1: length(SNRdB) % start looping by SNR
dB
% ********************* PPM signal generation ***************************%
x_inp=[];
for j=1:Ns
PPM_data=randi(1,M); % random binary number
PPM_data_dec_value=bi2de(PPM_data,'left-msb');% converting to decimal value
PPM_data_trial=zeros(1,2^M);% zero sequence of length 2^M
PPM_data_trial(PPM_data_dec_value+1)=1;% placing a pulse accoring to decimal value
x_inp=[x_inp PPM_data_trial]; % PPM symbol
end
% ********************* Channel ******************************************%
y_channel=awgn(x_inp,SNRdB(dB));% Additive White Guassiann Noise (AWGN)
% ********************* Receiver *****************************************%
% ********************* Slot Error Rate (SER) calulation *****************%
% Hard Decision Decoding HDD
x_out_HDD=zeros(1,Ns*(2^M));
x_out_HDD(find(y_channel>0.5))=1;
[err1, rate1]= symerr(x_inp, x_out_HDD);
Rate1(dB)= Rate1(dB) + rate1;
% Soft Decision Decoding SDD
x_out_SDD=[];
start=1;
finish=2^M;
for j=1:Ns
temp=y_channel(start:finish);
m=max(temp);
temp1=zeros(1,2^M);
temp1(find(temp==m))=1;
x_out_SDD=[x_out_SDD temp1];
start=finish+1;
finish=finish+2^M;
end
[err2, rate2]= symerr(x_inp, x_out_SDD);
Rate2(dB)= Rate2(dB) + rate2;
end % end for loop
% ********************* Plot the simulation result ***********************%
f1 = figure(1);
set(f1,'color',[1 1 1]);
semilogy(SNRdB,Rate1, 'r-*')
hold on;
semilogy(SNRdB,Rate2, 'b-*')
axis([0 12 0.001 1.2]);
xlabel( 'Signal-to-Noise Ratio (SNR)')
ylabel( 'Bit Error Rate (BER)')
title('Simulation PPM transmission over noise');
legend('SER - Hard Decision Decoding HDD', 'SER - Soft Decision Decoding SDD' )
grid on;
⛄ 运行结果
⛄ 参考文献
[1] 徐素妍, 曹坤梅. 基于Matlab语言的现代通信仿真分析[J]. 计算机应用, 2001(z1):2.
[2] 苏家辉. 基于MATLAB的语音信号去噪声处理研究与仿真[J]. 中国新通信, 2018, 20(15):1.
[3] 张海峰. 基于传递特性的车外通过噪声模拟与分析[D]. 江苏大学.