# Flattening out a power spectral density

The situation is as follows. I am generating a white noise voltage signal with a certain power spectral density amplitude of choice, from 0 to some cutoff frequency, for example 200 MHz. This proceeds as follows: first I make my white noise in Mathematica. I use a technique in which I convolve unit white noise (with variance = 1) with a self made FIR filter based on the amplitudes I want the real noise to have. This gives me a time trace, which corresponds to the desired spectrum very well after analysing it with periodograms. I then load the time trace into an arbitrary waveform generator (AWG). The AWG then produces the pattern, and I look at it through a spectrum analyzer. This helps me verify if the noise is as desired.

Now, there are a number of difficulties in this of course, but the main one turns out to be the finite sampling rate of the AWG. The one I use produces signals at 1.2GSamples, and thus cannot be expected to produce signals at over 600 MHz (the Nyquist frequency). However, a priori this is not a big deal; my cutoff is at 200 MHz anyway. But in practice, the AWG doesn't just produce perfect noise up to 600 MHz. When producing white noise there is a downward trend in the spectral density for increasing frequencies, which is undesired.

My question, is how I can postprocess my data knowing the downward trend in the spectral density to make it more flat. Of course 100% flatness will never be achieved, but I am sure that one could somehow mitigate the decline in some way, getting it better than what it is right now. I have to my disposal a theoretical spectrum that I want, a digital time domain trace that would produce this spectrum if perfectly executed, and the analyzed spectrum realized by the AWG. Is there some way I can combine this information to achieve my goal?

To clarify what I mean, below is a plot of the measured PSD, overplotted with the PSD that was to be produced. The part after the cutoff is simply the noise floor of the spectrum analyzer, which is not a problem.

Note that the low frequency point that deviates can be ignored, this is due to the spectrum analyzer.

• One idea that came to my mind is that, essentially, the AWG is applying a filter to my flat spectral density. Would I perhaps be able to construct an inverse of this filter, based on my measurements, and apply this to the time trace? I am not sure how one would proceed with this though. – user129412 Jun 24 '16 at 18:39
• One approach is to use the Wiener-Hopf equations to make an equalizer, since you have your original signal and the resulting signal (this will solve for the channel compensator)- see my earlier posts on this, if you have trouble finding I can include a link later (or search for my name on MathWorks code exchange site where I provided the code there as well as an example. – Dan Boschen Jun 25 '16 at 19:15
• Also see my response to "how to make CIC compensation filter" for similar techniques that could possibly be applied to this. – Dan Boschen Jun 25 '16 at 19:18
• Thanks for the comments! I have to say I don't immediately see how to apply your sinc function approach to this particular question. I'm not terribly experienced with filters, so that is probably my bad. I'm trying to look into the Wiener Hopf approach that you mentioned now, although I am mostly finding them to be differential equation related, but I'll dig into your post history! – user129412 Jun 25 '16 at 20:40
• Perhaps important to note is that I do not have the actual time trace produced by the AWG, just the power spectral density. One source I found on those Wiener Hopf equations gave a way to construct the filter from the time series before and after, but I don't see how that is easily translated to the frequency domain. I suppose that you referred to ch.mathworks.com/matlabcentral/fileexchange/… earlier on, which I think (?) takes a time trace at the in and output, does it not? – user129412 Jun 25 '16 at 20:43