After FFT I've set to zero some frequencies and I'd like to enhance the amplitude in order to recover the leak. I'd like to do a normalization in order to avoid distortion.
I've done in this way but the new signal is between 0 and 1 and so the result is incorrect:

maximum_data = np.max(fftdata)
minimum_data = np.min(fftdata)
maximum_abs = np.max(fftabs)
minimum_abs = np.min(fftabs)
normalization_factor = ((2**16)/2)-1
for i in range(len(fftdata)):
    fftdata[i] = ((fftdata[i] - minimum_data)/(maximum_data - minimum_data))*normalization_factor
    fftabs[i] = ((fftabs[i] - minimum_abs)/(maximum_abs - minimum_abs))*normalization_factor

How can I resolve the problem? What is the correct formula?

  • 1
    $\begingroup$ I'd strongly recommend not simply zeroing out bins in the fft. See this very helpful question. $\endgroup$ – Marcus Müller Mar 23 '19 at 14:59
  • $\begingroup$ To answer the question in your title: multiply with a constant number > 1. $\endgroup$ – Marcus Müller Mar 23 '19 at 15:14
  • $\begingroup$ @MarcusMüller I need a normalization of my signal in the range [-32768; 32767] in order to avoid distortion caused by any constant number. $\endgroup$ – Ausilia Mar 24 '19 at 17:00
  • $\begingroup$ Normalization is multiplication with a constant number. I'm really not sure what you're asking for here. $\endgroup$ – Marcus Müller Mar 24 '19 at 17:17
  • $\begingroup$ @MarcusMüller I explain better with an example: originally my signal stays in [-32768; 32768] (it is codified with pcm 16 bit); after zeroing FFT bins, the signal stays in [-10000; 7500]. Now, I'd like that the signals stays in [-32768; 32767] again. $\endgroup$ – Ausilia Mar 24 '19 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.