2
$\begingroup$

Approximately bandlimiting, or maybe exactly if x is exactly - example:

rfft(abs(x)**2)[210]
(-7.993605777301127e-15+0j)

enter image description here

I notice the original signal must be bandlimited by a certain amount for this to happen, and there appears to be a definite relationship.

Is there a formula that relates fft(|x|^2) and |fft(x)|^2 or fft(x) (DFT or CFT)?

Code minus plots:

import numpy as np
from numpy.fft import fft, ifft, rfft

N = 500
np.random.seed(0)
_x = np.random.randn(N) + 1j*np.random.randn(N)
_xf = fft(_x)
# force a certain bandlimit
_xf[:150] = 0
_xf[-150:] = 0
x = ifft(_xf)

print(rfft(np.abs(x)**2)[210])
$\endgroup$
4
  • $\begingroup$ Have you tried longdouble? It might be a numerical artefact $\endgroup$
    – Arnfinn
    Mar 6, 2023 at 14:25
  • 1
    $\begingroup$ At any rate, you are convoluting the spectra with itself in frequency domain for the squared signal, which here has approximately a triangular distribution, so zero at high freq. is reasonable. For the absolute value I suspect the equivalent convolution in frequency domain has several factors (i.e. a power series approximation), so I think the distribution will have much wider support, that is, not go to zero at high freq. $\endgroup$
    – Arnfinn
    Mar 6, 2023 at 14:36
  • $\begingroup$ @Arnfinn Well it's not numerics, though I think someone here may answer. May want to check in later! $\endgroup$ Mar 6, 2023 at 14:47
  • $\begingroup$ hmm it's clear for real-valued x, the |x| was a distraction $\endgroup$ Mar 6, 2023 at 15:10

1 Answer 1

4
$\begingroup$

The relationship is convolution: the magnitude squared in the time domain is the complex conjugate product as demonstrated below for the case of continuous time $x(t)$:

$$|x(t)|^2 = x(t)x^*(t)$$

Such a product in time is convolution in frequency. The spectrum of $x^*(t)$ for the CTFT (or $x^*[n]$ for the DFT) is mirrored of that for $x(t)$ and $x[n]$ but otherwise identical in terms of spectral occupancy. For this reason the resulting spectrum will be bounded to twice the bandwidth of time domain waveform (for the case of the DFT, this means the spectrum of $x[n]$ must have a spectral occupancy that is less than $N/2$ samples otherwise the result will fully occupy the DFT with additional distortions due to the spectral overlap.)

That said the relationship for the DFT (FFT) would be:

$$\texttt{FFT}\{ x[n] x^*[n] \} = X[k] \circledast X^*[-k]$$

Where the symbol $\circledast$ above represents a circular convolution, which conveniently can be determined from the FFT and IFFT using the following well known relationship (this is used for “fast convolution” or equivalently when one of the FFT results is itself conjugated “fast correlation”):

$$C[k] =\texttt {IFFT} \big[\,\texttt{FFT}(X[k])\,\texttt{FFT}(X^*[-k])\,\big]$$

Note- that if we rewrite the above known relationship to equivalently be the fft of the product of the inverse fft’s we get the original time domain result further showing this relationship!

$$\texttt{FFT}\{ x[n] x^*[n] \} =\texttt {FFT}\big[\,\texttt{IFFT}(X[k])\,\texttt{IFFT}(X^*[-k])\big]$$

$\endgroup$
6
  • 1
    $\begingroup$ I'm not very smart $\endgroup$ Mar 6, 2023 at 15:17
  • 1
    $\begingroup$ I think it is a very “convoluted” DSP trick $\endgroup$ Mar 6, 2023 at 15:33
  • $\begingroup$ too used to |x|'s spectrum in discussing |x|, good to save rediscovery time $\endgroup$ Mar 6, 2023 at 15:36
  • $\begingroup$ This is also a very blatant example of "not bandlimited (or $f_s$ < Nyquist) just means sinc interpolation alone can't recover it". $\endgroup$ Mar 6, 2023 at 15:50
  • 1
    $\begingroup$ Dan, in some of your equations you seem to equate $x^*[n]$ with IFFT$(X^*[k])$. Is that right? It should be IFFT$(X^*[-k])$. $\endgroup$
    – Matt L.
    Mar 6, 2023 at 21:18

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.