Reputation: 169
I am trying to generate Gussin white noise with standard deviation 7%
and sample frequency 2000 Hz
. Then calculate the power spectral density of it (PSD). The problem is when I plotted PSD I know that I have to get flat PSD. however, I did not
I used below code
clear;
clc;
x =7*randn(1,10000);
N=10000;
sample_frequency=2000;
fax_bin=[0 :N/2-1];
fax_Hz=fax_bin*sample_frequency/N;
FFT_A=fft(x);
spectra=FFT_A.*conj(FFT_A);
figure
plot(fax_Hz,spectra(1,1:5000));
Upvotes: 0
Views: 687
Reputation: 1264
It is a random process so you will never get it truly flat, it gets better with more samples. Additionally, plotting it on a dB-scale makes more sense.
plot(fax_Hz,10*log10(spectra(1,1:N/2)));
Upvotes: 2