📄 awgn.m
字号:
function [out1,out2]=AWGN(input,Eb_N0,Ps,k,R,P)
%*******************************************************************************************
%%% Note that SNR=(Eb/N0*R*k)/P, the Ps and Pn should calculated according to SNR, not Eb/N0
%%% This function generate and add the AWGN noise to the tansmetted signals
%%% input and out are all "serial" sequence
%%% Eb_N0 : ratio of bit energy to noise power spectral density
%%% input : input signal sequence(complex numbers)
%%% Ps : average power of the signal
%%% rb : i.e. Eb/N0, raito of information bit energe to AWGN noise power spectral density
%%% k : the number of bits of each symbol
%%% R : coding rate
%%% P : spreading factor, i.e. "SF"
%*******************************************************************************************
L=length(input);
ebn=10^(Eb_N0/10);
SNR=(ebn.*R.*k)./P;
pow_s=Ps;
pow_n=pow_s/SNR; %%% noise average power(devided to real and imaginary parts,so devided by 2)
delta=sqrt(pow_n/2);
x=randn(1,L)*delta;
y=randn(1,L)*delta;
noise=x+j*y;
out1=noise+input;
out2=pow_n;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -