How to generate white noise signal from a given PSD?

24 Ansichten (letzte 30 Tage)
Americo Cunha
Americo Cunha am 24 Feb. 2011
Beantwortet: David Goodmanson am 14 Aug. 2024
Hello,
I want to generate a white noise signal x(t) with a known value for the flat power spectral density (PSD) function. In other words, I want to specify a constant value S0 such that the PSD of x(t) is Sx(w) = S0.
The awgn function from Matlab generates a white noise vector given a signal-to-noise ratio (SNR) value as input parameter.
What value of SNR I need to specify in order to have the PSD of x(t) equal to the desired value S0?
Any help is welcome!
Americo
  1 Kommentar
Umar
Umar am 15 Jul. 2024
Hi Americo,
In order to calculate the required SNR using the relationship between the PSD and SNR, you need to use the formula to determine the SNR for a given PSD is which is SNR = S0 / (2 * delta_f), where delta_f represents the frequency resolution. Then, you can generate the white noise signal x(t) with the desired PSD using the awgn function in Matlab by specifying the calculated SNR value. By setting the SNR parameter to the computed value, you can ensure that the PSD of x(t) matches the desired constant value S0. For more information on awgn function, please refer to https://www.mathworks.com/help/comm/ref/awgn.html

Melden Sie sich an, um zu kommentieren.

Antworten (1)

David Goodmanson
David Goodmanson am 14 Aug. 2024
One can just create the desired waveform that has psd = S0 without resorting to S/N. The example below has a crazy large unphysical S0 just to make it easy to keep track of the result.
For w instead of f, the frequency range is 0 to 2*pi*Fs and S is reduced by a factor of (1/(2*pi)). periodogram is used to calculate psd = S.
S0 = 23 % desired spectral density dPave/df,
% positive frequencies only
n = 1e6; % number of array points
Fs = 1e9; % sampling frequency
% fft frequency range is approx. -Fs/2 to +Fs/2
y = sqrt(S0*Fs/2)*randn(1,n); % the required time domain waveform
[S f] = periodogram(y,[],[],Fs); % freq range is approx. 0 to Fs/2
% and S is doubled
mS = mean(S) % should equal S0
% check
delf = (Fs/2)/size(S,1);
I = sum(S)*delf % integral over the entire freqency band
% should equal Pave (average power)
Pave = mean(y.^2)
S0 = 23
mS = 23.0634
I = 1.1532e+10
Pave = 1.1532e+10
%%%%%%%%%%% w circular frequency version
S0 = 23 % desired spectral density dPave/dw,
% positive frequencies only
n = 1e6; % number of array points
Fs = 1e9; % sampling frequency.
% fft w range is approx. -(2*pi)*Fs/2 to +(2*pi)*Fs/2
y = sqrt(2*pi*S0*Fs/2)*randn(1,n); % the required time domain waveform
[S w] = periodogram(y,[],[],2*pi*Fs); % w range is approx. 0 to (2*pi)*Fs/2
% and S is doubled
mS = mean(S) % should equal S0
% check
delw = (2*pi*Fs/2)/size(S,1);
I = sum(S)*delw % integral over the entire w band
% should equal Pave (average power)
Pave = mean(y.^2)
S0 = 23
mS = 23.0236
I = 7.2331e+10
Pave = 7.2331e+10

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by