In the followinf code I am trying to generate a Complex Gaussian Noise:

n_3 = sqrt(0.1)*randn(1,K);
n_4 = sqrt(0.1)*randn(1,K);
beta_NLoS = (n_3+1i*n_4); % CN(0,0.1)

Does my code do as intended?


1 Answer 1


If you want a Circular Complex Gaussian Noise (Independent):

vComplexNoise = sqrt(noiseVar / 2) * (randn(1, numSamples) + (1i * randn(1, numSamples)))

For correlated noise you'll need to define the Co Variance Matrix and use Cholesky Decomposition.


Following @Stanley Pawlukiewicz advise, run the following code:

numSamples = 100000;
noiseVar   = 4;

mA = sqrt(noiseVar / 2) * (randn(numSamples, 1) + (1i * randn(numSamples, 1)));


You should see result which is very close to noiseVar on the screen.

  • $\begingroup$ so the code i written is just a complex gaussian ,not circular? $\endgroup$ Commented Aug 22, 2018 at 7:57
  • $\begingroup$ vComplexNoise = sqrt(0.1 / 2) * (randn(1, K) + (1i * randn(1, k))) like this? $\endgroup$ Commented Aug 22, 2018 at 7:59
  • $\begingroup$ Yep, just like you wrote above. Please mark this as answered. $\endgroup$
    – Royi
    Commented Aug 22, 2018 at 8:13
  • $\begingroup$ but is't the gaussian distribution $\frac{1}{\sqrt{\sigma^2 2*\pi}}$ $\endgroup$ Commented Aug 22, 2018 at 8:24
  • 1
    $\begingroup$ The formula for the Gaussian distribution with the variance in the denominator is the distribution function itself, not the random data itself! Then randn function will produce a (real) Gaussian (normal) distribution with a normalized variance of 1. So to get any other variance you need to scale the magnitude of whatever is generated by the standard deviation. Hence sqrt(noiseVar/2). The reason for the divide by 2 as Royi pointed out is that you are generating independent sequences that will sum together. For the sum of independent random variables the variances add. $\endgroup$ Commented Aug 22, 2018 at 10:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.