# ifft of signal without phase information

I have a chemical spectrum with amplitude on the Y axis and wavenumbers on the X axis, sampling interval I think this is $1.5^{10}$ hertz. I would like to reconstruct the amplitude/time representation of the original signal by performing a ifft of the signal however I have no phase information. Since the information is unchanging (constant) over time I don't think that the phase information is necessary for reconstruction of the original signal. Can I set the phase information to zero and still reconstruct the signal in this case and how do I incorporate the sampling interval in the matlab ifft routine for accurate frequency calculation?

This is what I think I should be using

sig = abs(ifftshift(ifft(complex(data.YData))));


Thanks

Dave

• You need the phase to reconstruct the original signal. – John Jan 13 '14 at 16:53
• What do you need the original signal for? – starblue Jan 14 '14 at 7:55
• I want to convert it to sound, see here for the application MUSIC OF THE CHEMICAL SPHERES – ejectamenta Jan 14 '14 at 10:20

Human perception of sound does not depend very much on the phase, this was once used in the VOCODER to compress long distance telephone communications.

So your general idea should work, only that the shape of the signal is arbitrary.

Could you check the documentation, would think that one applies ifftshift before ifft to mirror the application of fftshift after fft.

But probably you need a different kind of preparation: Assuming that the Y[k] represent the amplitude of the frequency

X[k]=k/N*fs/2, k=0,...,N-1,


where N is the length of the array and fs the sampling frequency. Then you need to double the length of Y and set

Y[N+k]=Y[N-1-k], k=0,...,N-1.


This surely can be more efficiently expressed using array operations, join Y and its reverse to form the new Y. Then apply directly ifft, without ifftshift, to get a signal with the given spectrum.

Update 14.1.:If the number of frequencies is rather small, an explicit evaluation as

$$\sum_{k:Y[k]\ne 0} Y[k]\cdot \sin(c\cdot X[k]\cdot t)$$

may be easier to implement. The factor c is to be fixed in such a way that the result is in the audible spectrum.

• Good, then I will normalize by the frequency as you suggest then mirror the array. – ejectamenta Jan 15 '14 at 12:46
• If the data array starts at a particular frequency then I am not sure that X[k]=k/Nfs/2, k=0,...,N-1, will work, maybe I will have to padd the spectrum with zeros and mirror around the zero frequency position prior to normalisation by Nfs/2 – ejectamenta Jan 15 '14 at 13:05
• Yes of course. This was not visible from your question. So, the above assumes that the frequency points in X are equidistant and start at 0. If not, you have to prepare such a situation by padding and interpolation. – Lutz Lehmann Jan 15 '14 at 13:35
• I implemented the algorithm as follows:  pad = zeros(1, data.XData(1)/(data.XData(2)- data.XData(1))); // get pad data Yn= [pad data.YData]; // pad frequency spectrum Yn= [Yn fliplr(Yn)]; // mirror about N plot(abs(ifft(complex(Yn)))); // plot the ifft result  however what I am seeing is a symmetric peak at 0 and a peak at N, not the time/amplitude spectrum I expected. – ejectamenta Jan 15 '14 at 13:51
• In the end I went for a peak detection approach which avoids the iFFT calculation, the sounds are actually pretty good. – ejectamenta Jan 15 '14 at 22:19

This is tricky. The phase information impacts the time domain form very much. For example white noise and a delta impulse have exactly the same amplitude spectrum, the only difference is in the phase.

Without any further assumptions or extra knowledge this can't be done. For example if you know that the signal is stationary, you could just try a random phase. If it's the impulse response of a causal system, you could try a minimum phase.

• "white noise and a delta impulse have exactly the same amplitude spectrum, the only difference is in the phase" no, that is not the only difference. even though the power of true white noise is infinite, we would classify that as a "power signal". and we would compare the dirac impulse to other one-shot "energy signals". but it is true that the phase of an impulse at $t=0$ is known and 0 and that the phase of white noise (doesn't matter where it's located because it's everywhere) is unknown and undefined. and they both have flat magnitude spectrum, but the units are different. – robert bristow-johnson Jan 13 '14 at 17:52
• Maybe I was a little sloppy here. Using an FFT (or any other flavor of the Discrete Fourier Series) assumes implicitly that you have periodicity in the time and the frequency domain. In that context the delta impulse is not just unity at n=0 but also at any n = kN, where k is an integer and N the FFT length. So in this interpretation power is also infinite for the delta impulse. My point being that given a magnitude spectrum that's all ones you can make noise, sweeps, or impulses by manipulating the phase accordingly. – Hilmar Jan 13 '14 at 19:41
• Or your anthropomorphized algorithm "assumes" that the FFT is a rectangular window on completely non-periodic data. But the impulse and white noise could still be scaled to make the analogy re phase relevance work. – hotpaw2 Jan 13 '14 at 22:45
• well, it looks like someone else previously from comp.dsp is here commenting. rather than open up that dispute, i would just say, sure, any number of periodic sequences can be cooked up that have identical flat magnitude in the DFT, but different phase. when the data is discrete-time, there is no dirac impulse (with a white spectrum) nor white noise. you can have a kronecker impulse and band-limited white noise. of the latter, once you sample it to send to the DFT, it's just a bunch of deterministic samples. all have finite power (from the POV of the periodic DFS). – robert bristow-johnson Jan 14 '14 at 3:04

You cannot reconstruct the time domain signal without the phase information, unless you make further assumptions about your signal. One set of assumptions is whether the signal is minimum or maximum phase - with those assumptions you could reconstruct the signal uniquely.

While the phase of a particular frequency component may not be important, what is important is the phase relationship between the different frequency components. If you changed the phase at different frequencies, you will end up with wildly different time domain responses. Consider the following signal: $$s(t) = \sin(2\pi f_1t) + 0.5\sin(2\pi f_2t +\phi)$$

If you think of having a dial which changes the value of $\phi$, then as you change it the resulting signal will also change. The situation gets even more complication when you add multiple sinusoids at different frequencies and each one has it's own phase.

• I can understand with a complex signal that changes over time (eg. at t1 a sine wave appears then at t2 another sine wave starts) the phase is important in the reconstruction, but when you have a continuous sound (eg. all my sine waves start at t0 and do not change until the end) then can't the phases all be set to 0 or to the same value – ejectamenta Jan 14 '14 at 15:20
• I can also notice the frequencies and amplitude of the main peaks in the FFT spectrum and reconstruct sine waves using these values and 0 phase a listener will hear these tones regardless of starting phase. The main point is that the sound perceived by the listener doesn't change if the phase is altered as we are only sensitive to frequency and amplitude? – ejectamenta Jan 14 '14 at 15:27