Continue to Site

# gaussian noise generation

Status
Not open for further replies.

#### sa gharibi

##### Newbie level 3
hello my dear friends
i wnat to generate a complex whaite gaussian noise with average power of 20 dB.
can any one help me?
tnx

#### WimRFP

##### Advanced Member level 5
You should provide us some more info.

Think of: spectral power density (for example in dBm/Hz), or spectral voltage density (for example nV/rt(Hz) ),
Frequency range (for example center frequency and bandwidth), flatness within the frequency range, sampling frequency, etc.

sa gharibi

### sa gharibi

Points: 2
Helpful Answer Positive Rating

#### sa gharibi

##### Newbie level 3
thanx for your reply!
I want to generate a complex gaussian noise with power of 15 dB and add it to my signal!

#### weetabixharry

##### Full Member level 4
You can generate N samples of complex white Gaussian noise with power sigma2 in Matlab or GNU Octave using the randn function:
Code:
n = (randn(1,N) + 1j*randn(1,N))*sqrt(sigma2/2);
To check the sample power of this noise is approximately equal to sigma2 (for sufficiently large N), you can then use:
Code:
Pn = n*n'/N
So, to get your SNR of 15dB, you first need to know the power of your signal. Then, you must set the noise power at 15dB below this. Putting this together:
Code:
% An example signal: complex exponential
N = 1000;
t = linspace(0,5,N);
s = exp(1j*2*pi*t);

% Sample power of signal
Ps = s*s'/N;

% Generate noise
SNRdb = 15;
sigma2 = Ps/10^(SNRdb/10);
n = (randn(1,N) + 1j*randn(1,N))*sqrt(sigma2/2);

% Add noise to signal
x = s + n;

% Plot noisy signal
plot(t, real(x));
hold on;
plot(t, imag(x), 'r');
legend('real(x)', 'imag(x)');

Status
Not open for further replies.