# How to Generate White Gaussian Noise with Known PSD in MATLAB

I want to generate white Gaussian noise with known PSD. Using wgn I can generate noise with specific power (dBW) but I want to generate a white noise with constant or know PSD.

Can anyone give me some idea. Thanks Franklin

• The very definition it white noise is a constant PSD... – Marcus Müller Nov 12 '17 at 10:04

The specific PSD is basically white noise which was filtered with a filter which its Magnitude is the same as the PSD.

This is a result of the Wiener Khinchin Theorem.

So if you have the shape of the PSD do the following:

1. Create a filter which in the Frequency domain has the magnitude (More accurately the squared magnitude ${\left| H \left( \omega \right) \right|}^{2}$) of the PSD you want (Namely, you don't care about the phase).
2. Create a White Noise.
3. Filter the white noise with the filter created in 1.

I would note that in the case of a White Noise the PSD is constant.
Hence in this case all you need is to generate white noise with normalized variance and then to multiply it by a constant (Changing its variance) to the value you're after.

Enjoy...

• Coud you a code for implementation? – David Aug 20 '18 at 15:03
• In the discrete-time LTI filtering with WSS input $x[n]$ and output $y[n]$, the PSD relation is $$S_{yy}(\omega) = |H(\omega)|^2 S_{xx}(\omega)$$, so did you mean Magnitude Square instead, that's why you don't care of the phase... Or did you mean another method of noise generation ? – Fat32 Aug 20 '18 at 15:26
• I made it more clear. I indeed meant that (It was abuse of the word magnitude). Thank You. – Royi Aug 20 '18 at 15:32