All labs › Learn › Communication Systems
All articlesAll labs

Probability Density Functions of Random Signals: Uniform, Gaussian and Rayleigh

Learn the probability density function of random signals. Compare uniform, Gaussian and Rayleigh densities, their mean and variance, and plot a PDF in MATLAB.

Updated 28 November 2026 · 4 min read · Designed by Fasih Ullah Saleem

01Why random signals need statistics02The uniform density03The Gaussian density04The Rayleigh density05Plotting a PDF in MATLAB06Reading the three shapes07Checking the mean and variance08Try it in the virtual lab09Questions and answers10Related topics
01

Why random signals need statistics

Noise, fading and the message of a real user cannot be written as a formula of time. They are random signals. We cannot predict one value, but we can describe how likely each value is. The probability density function, PDF, does this. For a random value x, the area under the PDF between two numbers is the probability that x falls between them.

P(a < x < b) = ∫ f(x) dx   from a to b
∫ f(x) dx = 1   over all x

The total area is always 1, because the value must be somewhere. A tall PDF means a narrow spread of values. A wide, low one means a large spread. The mean is the centre of mass of the curve and the variance measures its spread.

02

The uniform density

A uniform value is equally likely anywhere between a lower limit a and an upper limit b.

f(x) = 1 / (b − a)   for a ≤ x ≤ b, zero elsewhere
mean = (a + b) / 2,   variance = (b − a)² / 12

Example: a value uniform between 0 and 1 V has a mean of 0.5 V and a variance of 1/12, which is 0.083 V². This density describes the rounding error of an analog to digital converter. If the step size is Δ, the error is uniform over −Δ/2 to +Δ/2, so the noise power is Δ² / 12.

03

The Gaussian density

The Gaussian, or normal, density is the bell curve. It describes thermal noise, and any value that is the sum of many small independent effects. This follows from the central limit theorem.

f(x) = 1 / (σ √(2π)) · exp( − (x − μ)² / (2 σ²) )
  • The mean μ is where the peak sits. The standard deviation σ sets the width.
  • About 68 percent of values fall within ±1 σ of the mean, 95 percent within ±2 σ and 99.7 percent within ±3 σ.
  • For zero mean noise, σ² is the noise power, and σ is the rms voltage.

The chance that Gaussian noise goes above a level a is called Q(a/σ). A digital receiver makes a bit error when noise pushes the signal across the threshold, so bit error rates are Q function values.

04

The Rayleigh density

The Rayleigh density describes a magnitude that can never be negative. It occurs when you take the length of a vector whose two parts are independent zero mean Gaussian values with the same σ. The envelope of narrowband Gaussian noise follows it, and so does the signal strength in a radio link without a direct path, which makes it the standard model of fading.

f(r) = (r / σ²) exp( − r² / (2 σ²) )   for r ≥ 0
mean = σ √(π/2) = 1.253 σ,   variance = (4 − π) σ² / 2 = 0.429 σ²

The peak, called the mode, is at r = σ. Unlike the Gaussian, the Rayleigh density is not symmetric. It rises from zero, peaks at σ, and has a long tail to the right.

05

Plotting a PDF in MATLAB

Generate many samples, form a histogram and scale it so that its area is 1. Compare it with the formula.

N = 1e5;
g = randn(1, N);                  % Gaussian, mean 0, sigma 1
r = sqrt(randn(1,N).^2 + randn(1,N).^2);   % Rayleigh, sigma 1
histogram(r, 60, 'Normalization', 'pdf'); hold on
x = linspace(0, 5, 200);
plot(x, x .* exp(-x.^2/2))

With the option pdf the histogram heights are scaled so the area is 1, so the bars follow the formula. With a count of 100 000 samples the match is close. With 100 samples the bars are very rough.

06

Reading the three shapes

A quick check on a measured signal: plot its histogram, then look at the shape. Flat suggests uniform, a symmetric bell suggests Gaussian, and a hump with a long right tail that starts at zero suggests Rayleigh.

DensityRangeShapeTypical use
Uniforma to bflat boxrounding error, random phase
Gaussianall valuessymmetric bellthermal noise
Rayleighzero and aboveskewed humpnoise envelope, fading
07

Checking the mean and variance

The formulas for the mean and variance can be checked on generated data. The result gets closer to the formula as the number of samples grows.

r = sqrt(randn(1,1e5).^2 + randn(1,1e5).^2);
mean(r)     % close to 1.2533
var(r)      % close to 0.4292
u = rand(1,1e5);  mean(u), var(u)   % close to 0.5 and 0.0833

The error of a sample mean is about σ / √N. With 100 000 samples and σ near 0.65 the error is about 0.002, so the mean of r agrees with 1.2533 to the second decimal place. With 100 samples the error is about 0.07 and the match is poor. The sum of 12 uniform values minus 6 is close to a Gaussian value with variance 1, a quick way to see the central limit theorem at work.

08

Try it in the virtual lab

SinBench has free 3D benches and interactive demos for this topic. Open one to try the ideas above with real instruments, no sign up needed.

Lab 12

Random Signals and the Probability Density Function

Read the concepts →
09

Questions and answers

What is a probability density function?

It is a curve that shows how likely each value of a random quantity is. The area under it between two values is the probability of falling between them, and the total area is 1.

Why is thermal noise Gaussian?

It is the sum of the effects of a very large number of electrons moving randomly. The central limit theorem says such a sum is Gaussian.

Where does the Rayleigh density come from?

It is the density of the length of a vector made of two independent zero mean Gaussian values with equal variance. It models the envelope of noise and radio fading.

How do I plot a PDF from data in MATLAB?

Use histogram(x, 'Normalization', 'pdf'). It scales the bars so the total area is 1, so they can be compared with the PDF formula.

10

Related topics

Communication Systems

ASK and FSK: Digital Modulation of a Carrier

Learn amplitude shift keying and frequency shift keying: waveforms, bandwidth, detection, and error rates against Eb/N0, with a short MATLAB example.

Communication Systems

FFT in MATLAB: Frequency Axis, fftshift and Spectral Leakage

Use the FFT in MATLAB correctly: build the frequency axis, scale the amplitude, apply fftshift, and understand spectral leakage, windows and zero padding.

Communication Systems

Amplitude Modulation and the Modulation Index

Learn how amplitude modulation works: the AM equation, the modulation index from an oscilloscope picture, sidebands, bandwidth, power and overmodulation.

SinBench SinBench · Free virtual labsDesigned by Fasih Ullah Saleem
© 2026 Fasih Ullah Saleem. All rights reserved. fasihullahsaleem.com · About · Terms of Use · Privacy