Frage

I am working a dsp algorithm where I take the FFT of a time domain signal, compute the amplitudes of each bin using sqrt(real * real + imaginary * imaginary) and then modify the amplitude. How do I convert the modified amplitude back into the complex domain so that i can run the IFFT and recover the processed time domain signal?

War es hilfreich?

Lösung

You would most likely want to retain the phase and use this to reconstruct the new bin value. What you're effectively doing is modifying a complex number in polar form, i.e. changing the magnitude but retaining the phase:

mag = sqrt(re^2 + im^2)  ; convert re, im to polar (mag, phi)
phi = atan2(im, re)

mag = mag * scale        ; apply factor `scale` to magnitude

re = mag * cos(phi)      ; convert new mag, phi back to re, im
im = mag * sin(phi)
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top