Reputation: 60461
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?
Upvotes: 1
Views: 1276
Reputation: 70733
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.
Upvotes: 1
Reputation: 1270
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.
Upvotes: 2