awgn_channel.m

来自「RS编解码过程,并包括进制转换和域的变换,可用于RS码仿真」· M 代码 · 共 29 行

M
29
字号
%高斯信道
function [rs]=AWGN_Channel(ss,snr)
%The function is to implement  an AWGN channel
%ss is the input signal;
%sn denotes the signal-noise ratio

%separate the real and image parts of input signal, respectively
ssR=real(ss);
%ssI=imag(ss);
Lss=length(ss);

%calculate the power of the image part of input signal,
ssrcov=xcov(ssR);
scr=ssrcov(Lss)/Lss;
ns=scr/mpower(10,snr/10);
nsR=sqrt(ns); 

%calculate the power of the real part of input signal,
%ssicov=xcov(ssI);
%sci=ssrcov(Lss)/Lss;
%ns=sci/mpower(10,snr/10);
%nsI=sqrt(ns); 

%produce the AWGN , add it to input signal and form AWGN channel
noiseR=nsR*randn(1,Lss);
%noiseI=nsI*randn(1,Lss);
noise=noiseR;
rs=ss+noise;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?