📄 awgn_channel.m
字号:
%高斯信道
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -