Phase shift problem in Fast Fourier Transform I try to make graph/print for magnitudes and phase shifts for impulse response calculated by FFT.
For magnitude everything works perfect, but for phase shift I get some strange curve for higher frequencies. I can't figure out why. Could anyone help me?

I calculate phase shift by that:
atan2(fftOutput.imag(),fftOutput.real()) * 180.0/M_PI;

And for simply impulse, like: impulse[1024] = { 1, 0, 0, 0 ... 0 }

with no processing I expect straight line (phase shift for all freq bin should be zero).

But I get something like that (I drawn it in paint, cause I can't run my app at the moment, but it looks almost exactly the same):



Why is that?
Something is wrong with your FFT. This looks like your input signal is either time reversed or shifted (circular) by one sample to the left.