# zero-phasing frequency components while keeping the same magnitude, in Matlab

How is it possible?

I was thinking of taking just the real part of the DFT of my signal (isn't that zeroing out phases?) with

real(fft(X))


but the magnitudes of that result don't match :

abs(real(fft(X))) != abs(fft(X))