# Recovering signal from magnitude and phase of FFT

I'm trying to code the basics of an analysis-synthesis system on MATLAB, but I'm getting incorrect results. From the Wikipedia page:

$$X_k=\lvert X_k\rvert e^{i\angle X_k}$$

Here's a simple MATLAB code:

y = speech(10:10+127);

yfft = fft(y,128);

spec = abs(yfft);
phase = unwrap(angle(yfft));

Y = spec .* exp(sqrt(-1)*phase);

yinv = ifft(Y,128);

yet y and yinv do not match. What's the issue here?

• what's your sample rate? 128 samples worth of DFT surely doesn't sound like a "recognizable" sound. Aug 19 '16 at 9:11