0
$\begingroup$

I have a trivial fourier transform question. I have a correlation function, C(t), with complex components in the time-domain, and dt. I would like it in the frequency domain, C(w), like from Numerical Recipes:

enter image description here

I believe this involves an inverse fourier transform and grid-shifting. I know numpy iFFT divides by sequence length, while numpy FFT is normal fourier transform. Knowing this, how can I verify Parseval's theorem (https://stackoverflow.com/questions/30073508/parsevals-theorem-doesnt-work-with-ifft)?

In python:

c_w_num = np.fft.ifft(np.fft.ifftshift(c_t))

As a sanity check, grid-shifting gives me back the original c_t:

c_t_num = np.fft.fftshift(np.fft.fft(c_w_num)) == c_t

So, I have dt, but I cannot figure out how to get the correct w, or dw.

For example, when I use the formula:

2.0*np.pi/(time_final - time_initial)

The dw generated does not give me something that satisfies Parseval's theorem. Any ideas of what I'm doing wrong? Does C(w) generated with iFFT not satisfy Parseval's (below)? Thanks! enter image description here

$\endgroup$

1 Answer 1

1
$\begingroup$

Perceval's theorem is satisfied with you apply scale factor of $1/\sqrt(N)$ for both the forward and inverse transform. I.e.

If $$X(k) = \frac{1}{\sqrt{N}}\sum_{n=0}^{N-1} x(n) e^{-j2\pi\frac{kn}{N}}$$

then

$$x(n) = \frac{1}{\sqrt{N}}\sum_{k=0}^{N-1} x(n) e^{j2\pi\frac{kn}{N}}$$

and

$$\sum_{n=0}^{N-1}|x(n)|^2 = \sum_{k=0}^{N-1}|X(k)|^2 $$

$\endgroup$
2
  • $\begingroup$ Thank you! I realized that iFFT in python automatically divides by N. So I think, actually, to fix it for DFT it is: np.sum(np.abs(c_t)**2) np.sum(np.abs(c_w)**2) * N Is that correct way to think about it? $\endgroup$
    – Camerann
    Commented Dec 28, 2021 at 21:42
  • $\begingroup$ There are many different ways to think about. You can scale the energy one or the other domain or write wrapper around the DFT that implements your scaling of choice $\endgroup$
    – Hilmar
    Commented Dec 29, 2021 at 15:19

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.