2

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])

OverLordGoldDragon
  • 8,912
  • 5
  • 23
  • 74
  • Have you tried longdouble? It might be a numerical artefact – Arnfinn Mar 06 '23 at 14:25
  • 1
    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. – Arnfinn Mar 06 '23 at 14:36
  • @Arnfinn Well it's not numerics, though I think someone here may answer. May want to check in later! – OverLordGoldDragon Mar 06 '23 at 14:47
  • hmm it's clear for real-valued x, the |x| was a distraction – OverLordGoldDragon Mar 06 '23 at 15:10

1 Answers1

4

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]$$

Jdip
  • 5,980
  • 3
  • 7
  • 29
Dan Boschen
  • 50,942
  • 2
  • 57
  • 135