1

RosettaCode gives a simple implementation of the Cooley–Tukey FFT algorithm here. The question is the following and is from a mathematical and programming point of view. Suppose that an input of a program is the spectrum of a signal, and we want to generate a signal which has such a spectrum. If am correct, we need to take the inverse FFT of the input spectrum.

The code given by RosettaCode is the following:

// inverse fft (in-place)
void ifft(CArray& x)
{
    // conjugate the complex numbers
    x = x.apply(std::conj);

    // forward fft
    fft( x );

    // conjugate the complex numbers again
    x = x.apply(std::conj);

    // scale the numbers
    x /= x.size();
}

But this can only generate one signal. But several signals can have the same spectrum. So how to add a parameter to be able to generate these different signals?

Vincent
  • 57,703
  • 61
  • 205
  • 388
  • 1
    Different signals can have the same magnitude spectrum (like two sine wave segments with different starting phase) but cannot have the same full spectrum. – mtrw May 11 '15 at 16:25

2 Answers2

2

No, different signals have different Fourier transforms; it is invertible. N complex numbers in, N complex numbers out; the discrete Fourier transform amounts to multiplying a vector of samples by a nonsingular matrix, getting a vector of the same size.

You might be confusing an actual Fourier transform with a "spectrum" obtained taking the magnitude of the Fourier transform or with the result of other information-destroying operations.

Lorenzo Gatti
  • 1,260
  • 1
  • 10
  • 15
  • Taking the magnitude combines the real and imaginary parts of the complex number, which is how the phase was encoded. – Mark Ransom May 11 '15 at 20:40
1

It is a property of the FFT basis transform that unique finite signals have unique finite spectrums (as in the full complete complex vector), and vice versa. If the phase is different, the components of the complex frequency will also be different.

hotpaw2
  • 70,107
  • 14
  • 90
  • 153