From the MATLAB code below where do these theoretical equations for Rayleigh fading and white Gaussian noise come from? Or how are they derived?

h = 1/sqrt(2)*[randn(nrx,ntx,N/ntx) + 1i*randn(nrx,ntx,N/ntx)]; % Rayleigh channel
n = 1/sqrt(2)*[randn(nrx,N/ntx) + 1i*randn(nrx,N/ntx)]; % white gaussian noise, 0dB variance
  • $\begingroup$ Are you basically asking why there formulas are used? $\endgroup$
    – Phonon
    Commented May 19, 2014 at 23:57
  • $\begingroup$ Want to generate Exponential distributed random variable from the square of rayleigh distributed random variable.... lots of difference between direct generated exponentional distributed rv & generated from previous process ...pls help me regarding scalling factor to make all power zero.. $\endgroup$
    – user18174
    Commented Nov 8, 2015 at 13:22

2 Answers 2


The Rayleigh fading channel equation you provided comes from the property that given two independent zero-mean Gaussian random variables with equal variance $X \sim N(0,\sigma^2)$ and $Y \sim N(0,\sigma^2)$, the random variable $R = \sqrt{X^2+Y^2}$ is Rayleigh distributed (see for example wikipedia). In the code you provided, the real and imaginary components (generated by independent calls to randn) generally meet this condition (or at least approximates it quite well for reasonable pseudo-random generator) and the magnitude of h would thus have a Rayleigh distribution.

In addition, it is generally assumed that the signals' power is preserved on average, that is $E\{R^2\} = 1$. Now given how we defined $R$: $$ \begin{align} E\{R^2\} &= E\{X^2+Y^2\} \\ &= E\{X^2\}+E\{Y^2\} &\mbox{(linearity of expectation)} \\ &= 2E\{X^2\} &\mbox{($X$ and $Y$ identically distributed)} \\ &= 2\sigma^2 &\mbox{($X$ and $Y$ zero-mean Gaussian)} \end{align} $$

So the signal power is preserved on average when $\sigma = 1/\sqrt{2}$. This is also the scaling factor that must be used if starting with unit variance Gaussian pseudo-random variables (as is the case with MATLAB's randn).

Similarly, given a complex-valued Gaussian noise $n$ defined as $n = n_{\scriptsize \mbox{real}} + i\cdot n_{\scriptsize \mbox{imag}}$, where both real and imaginary components are Gaussian distributed with variance $\sigma_n^2$, the noise power is $E\{|n|^2\} = E\{n_{\scriptsize \mbox{real}}^2 + n_{\scriptsize \mbox{imag}}^2\}$. By a similar argument as above, it follows that $E\{|n|^2\} = 2\sigma_n^2$. To obtain noise with unitary power, we thus need $\sigma_n = 1/\sqrt{2}$.

Note that the notion of unitary power only makes sense once a measurement unit has been established. Quite often the noise power is defined relative to the signal power. In that case, a noise power of 1 (or 0dB) in signal power's units would mean that the power of the noise is the same as that of the signal.


So, it looks like the Gaussian noise is correctly generated, while the Rayleigh channel is generated incorrectly.

Namely, we're generating an array of real normally distributed random numbers and imaginary normally distributed random numbers, scaling both by $\frac{1}{\sqrt{2}}$. This works well for Gaussian, since on average their magnitude will indeed be 1 since $$\sqrt{ \frac{1}{\sqrt{2}}^2 + \frac{1}{\sqrt{2}}^2 } = 1.$$

However, we can't directly get Rayleigh distribution by using Gaussian distribution alone (provided by randn). We should use raylrnd instead. In this case the same argument applies for the $\frac{1}{\sqrt{2}}$ scaling.

  • 1
    $\begingroup$ Unfortunately, there are several incorrect statements in this answer. Rayleigh fading is a multiplicative channel disturbance. The amplitude of the RF signal is multiplied by a Rayleigh RV and the phase is shifted by a random amount. This is equivalent to multiplying the I and Q components of the RF signal by (zero-mean) independent Gaussian variables with identical variance. The AWGN is, as the name suggest, additive white Gaussian noise and this adds to the Rayleigh faded signal as two iid Gaussian RVs with equal variance. See also the Box-Muller method for generating Gaussian RVs. $\endgroup$ Commented May 21, 2014 at 3:09

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.