I'm trying to think of how to construct a filter based on the following scenario. I have some time trace with a certain known power spectral density (I can verify this with a periodogram of the time trace). The time trace then goes into a machine that realizes it, which does so with some level of imperfection. Treating the device as a black box, it is essentially a filter that is applied to the time trace, and produces a slightly adjusted power spectral density. This power spectral density I can then measure with a spectrum analyzer.

So I'm wondering, can I apply a preemptive filter to my time trace, before it goes into the black box, so that I get my desired power spectral density? I suppose I should have all the information I need as I know the power spectral density before and after the black box, which should somehow allow me to construct a type of inverse filter. How exactly I am not sure of however, and that is my main question.

I should also note that I tried a much less clean method. I took the power spectral density after the black box, and simply mirrored it, and used this as a preemptive filter. This actually seems to work quite well in the sense that the resulting PSD has the correct shape (it was sloping downwards before while it should be straight, which this method achieves), but the amplitudes are no longer correct and rescaling the data is problematic. So I figured a more analytic approach would be required.

  • $\begingroup$ Do you know the relation between the power spectra of the input and output signals of a linear time-invariant (LTI) filter, as given in this answer? Would that be enough for you to determine the magnitude response of the filter you're looking for? $\endgroup$
    – Matt L.
    Jun 25, 2016 at 17:37
  • $\begingroup$ I apologise for my slow reply, I didn't see your comments until earlier. Yes, I should know this relation, or at least I am inputting a relatively flat spectrum and I know the spectrum that comes out. So in principle that tells me |H(omega|^2. Should I then pre-filter my data with a 1/|H(omega)|^2 filter? $\endgroup$
    – user129412
    Jun 25, 2016 at 20:36

1 Answer 1


If $S_x(\omega)$ is the desired input power spectral density (PSD), and $S_y(\omega)$ is the PSD at the output of the black box, which has the (unknown) frequency response $H(\omega)$, then the following relation holds:


Now you want to cascade the black box with a filter to recover the original PSD $S_x(\omega)$ from the distorted PSD $S_y(\omega)$:


From $(2)$ it immediately follows that

$$|G(\omega)|=\sqrt{\frac{S_x(\omega)}{S_y(\omega)}},\quad S_y(\omega)\neq 0\tag{3}$$

You need to design a filter with magnitude response $|G(\omega)|$ given by $(3)$. Note that for this application, the filter's phase response is irrelevant.

  • $\begingroup$ I think this is close to what I am thinking of, yes. Perhaps to clarify; I start with a spectral density S_x(omega), it goes into the black box, and it comes out as S_d(omega). I guess that from this one can deduce |H(omega)|^2 by a simple comparison. I then want to find the |G(omega)|^2 such that S_x |G|^2|H|^2 = S_x; it has to compensate (or equalize I think you called it) |H|. Is that what is meant by the above? $\endgroup$
    – user129412
    Jun 25, 2016 at 20:53
  • $\begingroup$ To go into it a bit more specifically; do you mean that I divide S_d by S_x to get |H|^2, and then take sqrt(S_d)/(Sqrt(S_x)*|H|)? Given that I have S_d and S_x. $\endgroup$
    – user129412
    Jun 25, 2016 at 20:54
  • $\begingroup$ Ah, no, then I was not clear in what I said. I have a time trace that has the desired PSD to begin with. However, the black box essentially distorts it, and results in a slightly different PSD than the one that was input. I want to essentially take out the black box, by cleverly filtering the input PSD. $\endgroup$
    – user129412
    Jun 25, 2016 at 21:13
  • $\begingroup$ @user129412: Do you know the frequency response of the black box? Do you know the original PSD of the input sequence? $\endgroup$
    – Matt L.
    Jun 25, 2016 at 21:14
  • $\begingroup$ I know the original PSD of the input sequence. And I can measure what the black box does to that original PSD, in the sense that I can record the PSD it outputs for a given PSD input. $\endgroup$
    – user129412
    Jun 25, 2016 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.