my friend the complex number
douglas irving repetto
Mon Dec 8 01:03:15 EST 1997
let's say i do an fft of some real signal, and one of the complex pairs i
get out (in the form x + yi) is this:
-2.62 + -8.04i
to get the magnitude of the band i do this:
mag = sqrt(x^2 + y^2)
mag = R = sqrt(-2.62^2 + -8.04^2) = 8.4561220426387
great. to get the phase i do:
phase = atan(y/x)
phase = atan(-8.04/-2.62) = 1.2557771591334
so now i have a magnitude/phase pair. now if i want to do an ifft on
the pair i have to go back to complex like this:
x = Rcos(phase)
x = 8.4561220426387 * cos(1.2557771591334) = 2.62
whoops, wrong sign!
y = Rsin(phase)
y = 8.4561220426387 * sin(1.2557771591334) = 8.04
i end up with 2.62 + 8.04i - both x and y have changed their sign!
what's going on here? i'm really really sure that i haven't discovered an error
in FFT theory, so i must have discovered (another) error in my head.
it seems that when i compute the magnitude i will always lose the
signs, since i'm squaring both numbers. and when i compute the phase, i will
lose the signs if both numbers are negative. ??? should i not be
getting negative numbers in my complex pairs to begin with? clearly i'm lost.
please educate me.
More information about the music-dsp