# Obtaining real numbers from FFT with same length as original signal

In this article the real valued time domain signal is transformed to the frequency domain to extract some features like mean or variance.

But after transform to the frequency domain I calculate average hourly values (original measurements are 1/hour), so I need the signal in the frequency domain with the same length as the signal in the time domain.

Later I need features as real numbers (e.g. mean, variance), so I also need real numbers in the frequency domain. To this end, I think they use PSD. But after using Scipy's PSD (Welch estimation) I get much shorter array.

Question:

1. How can I get real valued array in the frequency domain from the signal with the same length as the original signal?

2. How should I use FFT / real FFT / PSD to get this (what arguments' values should I use)?

3. Would taking absolute values of the FFT output make sense?

• after the DFT (the FFT is but an implementation of the DFT), the values are in general complex. If you don't want that, you don't want the DFT/FFT, but it's not clear what you actually want. Engineering thought: First define what you need before describing a solution. Also, the DFT is a mapping between vectors of the same length, so the "same length" is inherently never a problem. May 16 at 11:41
• @MarcusMüller I want to recreate the paper results. I know it's not precise and I just guess what authors meant. I just need to do something with those complex numbers which would at least make sense. May 16 at 11:43
• Well, then the question is not what you want to express with these numbers, but what the paper wants to express with these numbers. Maybe it's as easy as taking the magnitude (squared?), maybe not. But to be brutally honest, from a signal processing scientist's point of view, a paper that isn't mathematically accurate is inaccurate and irreproducible to a first approximation. However, it seems eq. (3) in that paper is actually an actual formula, so maybe we're confusing ourselves here? May 16 at 11:59

This representation is formed by complex numbers, eliminating the imaginary part of each number in the frequency-domain signal. For this transformation, it is needed to calculate the power spectral density (PSD), as shown in Equation (3), $$P = \lim_{T\to\infty} \frac{1}{T} \int_0^T |x(k)|^2 dt \tag{3}$$ where $$P$$ represents the energy from the signal, $$T$$ represents the length of the signal lapse and $$x(k)$$ represents the frequency-domain signal. The spectrum is normalized by the length of the signal.
The PSD is a real function with respect to frequency $$k$$, so it has the same length of FFT result $$x(k)$$ if you keepace with Eq. (3).