get_channel_white_noise.m
上传用户:cjx922
上传日期:2017-12-13
资源大小:205k
文件大小:1k
源码类别:

通讯编程

开发平台:

Matlab

  1. function [noise_vector,channel,a]=get_channel_white_noise(channel,signal_sequence)
  2. %获得信道加性高斯白噪声,并且得到的a值用来进行功率分配
  3. if (size(signal_sequence,2)~=0)
  4.     S=mean(abs(signal_sequence).^2);
  5. else
  6.     S=0;
  7. end
  8. SNR_linear=10^(channel.noise.SNR/10);
  9. channel.noise.sigma=sqrt(S/(2*SNR_linear));
  10. noise_vector=(randn(size(signal_sequence))+j*randn(size(signal_sequence)))*channel.noise.sigma;
  11. a=channel.attenuation.h_mag.*channel.attenuation.h_mag/(2*channel.noise.sigma^2);%用来为功率分配用