Box-Mullar Transform generates random noise where noise samples are independent, standard, and normally distributed. So, we can say this type of noise is Gaussian noise.
In MATLAB Codes below, independent random variables u1 and u2 are uniformly distributed between 0 and 1 and then transformed using the Box-Muller method to obtain pairs of independent, standard, normally distributed random variables z0 and z1.
MATLAB Code for Generating Random (Gaussian) Noise
clear all;
close all;
numSamples = 1000; % Number of samples
gaussianNoise = generateGaussianNoise(numSamples);
disp(gaussianNoise);
function noise = generateGaussianNoise(numSamples)
% Generate Gaussian noise using Box-Muller transform
noise = zeros(1, numSamples);
% Generate pairs of independent, standard, normally distributed random variables
for i = 1:2:numSamples
u1 = rand();
u2 = rand();
z0 = sqrt(-2 * log(u1)) * cos(2 * pi * u2);
z1 = sqrt(-2 * log(u1)) * sin(2 * pi * u2);
noise(i) = z0;
if i+1 <= numSamples
noise(i+1) = z1;
end
end
end
Output
MATLAB Code for Generating AWGN Noise
clear all;
close all;
numSamples = 1000; % Number of samples
noisePower = 1; % Desired noise power
awgnSignal = generateAWGN(numSamples, noisePower);
% Plot the AWGN signal
plot(awgnSignal);
xlabel('Sample');
ylabel('Amplitude');
title('AWGN Signal');
function noise = generateAWGN(numSamples, noisePower)
% Generate Gaussian noise using Box-Muller transform
noise = zeros(1, numSamples);
% Generate pairs of independent, standard, normally distributed random variables
for i = 1:2:numSamples
u1 = rand();
u2 = rand();
z0 = sqrt(-2 * log(u1)) * cos(2 * pi * u2);
z1 = sqrt(-2 * log(u1)) * sin(2 * pi * u2);
noise(i) = z0;
if i+1 <= numSamples
noise(i+1) = z1;
end
end
% Scale the noise to have the desired power
currentPower = sum(noise.^2) / numSamples;
scalingFactor = sqrt(noisePower / currentPower);
noise = noise * scalingFactor;
end
Output
Differences Between Gaussian Noise and AWGN
- Gaussian noise refers to noise that follows a Gaussian (normal) distribution. It's characterized by having values distributed symmetrically around a mean value, with the probability density function given by the bell-shaped Gaussian curve.
- Gaussian noise can have any mean and variance, and it's not necessarily additive or white (i.e., frequency-independent).
- AWGN is characterized by having zero mean and constant power spectral density across all frequencies, making it ideal for modeling many practical noise scenarios in communication systems
Copy the MATLAB Codes from here
Read more about