www.gusucode.com > DS-cdma仿真matlab程序 > code8/cdma/awgn_complex.m

    %***********************************************************
%        This mfunction generates faded envelope and phase 
%        corresponding to Rayleigh fading
%
%        AUTHOR: Wenbin Luo
%        DATE  : 05/01/01
%
%        FUNCTION SYNOPSIS: 
%        y = awgn_complex(x,var)
% 
%        Parameter Description: 
%        x   ---> input signal (complex)
%        var ---> variance
%        y   ---> y = x + AWGN                  
%**********************************************************
function y = awgn_complex(x,var)
%  Generate bivariate Gaussian uncorrelated 
%  random variables
mu = zeros(1,2);
C = var*eye(2,2);
L = length(x);
r = mvnrnd(mu,C,L);
%  Convert to polar coordinates and compute 
%  magnitude and phase 
z = r(:,1) + j*r(:,2);

x = x(:); 
y = x + z;

%**********************************************************