目录
💥1 概述
📚2 运行结果
🎉3 参考文献
👨💻4 Matlab代码
💥1 概述
数字信号在传输中往往由于各种原因,使得在传送的数据流中产生误码。所以通过信道编码这一环节,对数码流进行相应的处理,使系统具有一定的纠错能力和抗干扰能力,可极大地避免码流传送中误码的发生。提高数据传输效率,降低误码率是信道编码的任务。信道编码的本质是增加通信的可靠性。但信道编码会使有用的信息数据传输减少,信道编码的过程是在源数据码流中加插一些码元,从而达到在接收端进行判错和纠错的目的。
加性高斯白噪声(AWGN)是一个数学模型,用于仿真发射机和接收机之间的信道。这个模型是线性增加的宽带噪声,具有恒定的频谱密度和高斯分布的幅度。AWGN 不适用于衰落、互调和干扰测试。
📚2 运行结果
主函数部分代码:
SNR = [-25:1:15]; L = length(SNR); BER_BPSK_Simulation=zeros(1,L); err =zeros(1,L); N=500; %number of symbols transmitted Global_counter = 0; code1 = randi([0,1],1,32); code2 = randi([0,1],1,32); code3 = randi([0,1],1,32); code4 = randi([0,1],1,32); code5 = randi([0,1],1,32); code6 = randi([0,1],1,32); code7 = randi([0,1],1,32); code8 = randi([0,1],1,32); code1 = 2*(code1-0.5); code2 = 2*(code2-0.5); code3 = 2*(code3-0.5); code4 = 2*(code4-0.5); code5 = 2*(code5-0.5); code6 = 2*(code6-0.5); code7 = 2*(code7-0.5); code8 = 2*(code8-0.5); for si=1:length(SNR) while (err(si)< 600) Global_counter =Global_counter+1; trans = zeros(1,32*N); X_un1 = randi([0,1],1,N); X_un2 = randi([0,1],1,N); X_un3 = randi([0,1],1,N); X_un4 = randi([0,1],1,N); X_un5 = randi([0,1],1,N); X_un6 = randi([0,1],1,N); X_un7 = randi([0,1],1,N); X_un8 = randi([0,1],1,N); X1 = 2*(X_un1-0.5); X2 = 2*(X_un2-0.5); X3 = 2*(X_un3-0.5); X4 = 2*(X_un4-0.5); X5 = 2*(X_un5-0.5); X6 = 2*(X_un6-0.5); X7 = 2*(X_un7-0.5); X8 = 2*(X_un8-0.5); counter = 0; for i=1:N index = (counter*32)+1; trans(index:index+31) = (X1(i)*code1) + (X2(i)*code2) + (X3(i)*code3) + (X4(i)*code4) + (X5(i)*code5) + (X6(i)*code6) + (X7(i)*code7) + (X8(i)*code8); counter = counter +1; end N0 = 1/(10^(SNR(si)/10)); noisevec = sqrt(15*N0)*randn(size(trans)); R = trans + noisevec; %% Integrating over the code %% res1 = zeros(N); res2 = zeros(N); res3 = zeros(N); res4 = zeros(N); res5 = zeros(N); res6 = zeros(N); res7 = zeros(N); res8 = zeros(N); %Result = zeros(L,N); counter = 0; for k=1:N index = (counter*32)+1; res1(k)= sum(R(index:index+31).*code1)/32; res2(k)= sum(R(index:index+31).*code2)/32; res3(k)= sum(R(index:index+31).*code3)/32; res4(k)= sum(R(index:index+31).*code4)/32; res5(k)= sum(R(index:index+31).*code5)/32; res6(k)= sum(R(index:index+31).*code6)/32; res7(k)= sum(R(index:index+31).*code7)/32; res8(k)= sum(R(index:index+31).*code8)/32; counter = counter +1; end result1 = res1 > 0; result2 = res2 > 0; result3 = res3 > 0; result4 = res4 > 0; result5 = res5 > 0; result6 = res6 > 0; result7 = res7 > 0; result8 = res8 > 0; diff1 = zeros(1,N); diff2 = zeros(1,N); diff3 = zeros(1,N); diff4 = zeros(1,N); diff5 = zeros(1,N); diff6 = zeros(1,N); diff7 = zeros(1,N); diff8 = zeros(1,N); for i=1:1:N diff1(i) = result1(i)-X_un1(i); diff2(i) = result2(i)-X_un2(i); diff3(i) = result3(i)-X_un3(i); diff4(i) = result4(i)-X_un4(i); diff5(i) = result5(i)-X_un5(i); diff6(i) = result6(i)-X_un6(i); diff7(i) = result7(i)-X_un7(i); diff8(i) = result8(i)-X_un8(i); end
🎉3 参考文献
[1]丁凯.AWGN信道中BPSK误码率仿真分析[J].微处理机,2021,42(03):23-26.
部分理论引用网络文献,若有侵权联系博主删除。