# Understanding the result of the fft algorithm

Understanding the result of the fft algorithm.

I need help understanding the FFT calculation results.

Recently, I have been interested in signal analysis, so I have created and understood fft algorithms.

My specific questions are as follows.

When the complex number, which is the result of the fft transformation, is displayed on the complex plane and the distance from the origin is calculated, the meaning of the value is known as amplitude. The result of the fft algorithm is complex, and the absolute value of the real part is less than 10, and the absolute value of the imaginary part is more than 10000. Is this the right situation? Currently, the length of the voice signal data is 41278.

Below is part of the result value.

{ re: 12.010356845500022, im: 6790.977397750974 }
{ re: 11.331472604179078, im: 3384.867732243245 }
{ re: 10.868698153019578, im: 3968.6697612994003 }
{ re: 10.930208906879702, im: 1689.332725124391 }
{ re: 8.25000967783374, im: 12436.209080582033 }
{ re: 10.189814004377867, im: 1982.4643461369433 }
{ re: 10.71733497571107, im: 6623.352885444263 }
{ re: 9.554291319475688, im: 862.3145173349678 }
{ re: 7.35670677360367, im: 11270.160881373446 }
{ re: 7.571125714550484, im: 6202.489135470153 }


My question is simple. I wonder if the fft algorithm made of nodejs worked normally.

The signal data length is 41278, The frequency range was set to 2^16, a value of 2^n greater than the signal data length.

0 ~ 41278 : signal data

41279 ~ 2^16 : signal data = 0

length : 2^16 = 65536

The result of performing the fft conversion in this state... While the number of real numbers is small, The imaginary part is very big. I wonder if the fft transformation is correct.

If the fft conversion result is calculated as the distance from the origin of the complex plane, the amplitude of the corresponding frequency comes out, and my result is that the amplitude is too large.

• What is the actual frequency range of this snippet? We would need a lot more details about your analysis and data to check whether this is correct or not. It does look wrong though: that would be very unusual for a voice signal. Feb 8, 2022 at 13:30
• @Hilmar The signal data length is 41278, The frequency range was set to 2^16, a value of 2^n greater than the signal data length. signal data 0 ~ 41278 : signal data 41279 ~ 65536 : 0 After that, we proceeded with fft. Therefore, the frequency range is 0 to 65536. Feb 9, 2022 at 4:26
• Frequency is measured in Hz. I was specifically asking about the frequencies (in Hz) of the data that you are showing in your table. This will help to determine if this is "normal" for voice or not. Feb 9, 2022 at 16:18
• @Hilmar The frequency of the above table data is... This is an excerpt of data from 32770 to 32779. Feb 10, 2022 at 6:51
• These are still numbers not Hz. Assuming that your sample rate is 44.1 kHz that would actually be -22049 Hz. That's almost exactly the Nyquist frequency. You shouldn't have any data there at all otherwise you have aliasing. There is certainly no voice energy there. It's also wrong since the data at Nyquist must be real. So close at Nyquist it should be mostly real Feb 10, 2022 at 16:34

It is causal, real signals specifically (such as the OP's voice signal) that will be Hermetian symmetric in frequency (which means the positive frequency components will have the same magnitude and opposite phase as the negative frequency components), and we see this in the result for the Fourier Transform as well as the Discrete Fourier Transform (the DFT, for which the FFT is an algorithm to compute the DFT very efficiently). If we had a non-causal real waveform that was symmetric about the time axis at $$t=0$$, the Fourier Transform would also be real and is known as "zero-phase". It is the delay in time to make the time domain waveform causal when compared to such symmetric signals that introduces the necessary linear phase in frequency, which we see in the DFT result.

Further, the DFT is periodic in frequency over $$N$$ samples for $$N$$ samples given in time, so if the $$N$$ samples are given from $$n=0$$ to $$n=N-1$$, this is representative of the frequency samples from DC ($$f=0$$) to one sample less than the sampling rate. The samples from $$N= N/2 \ldots N-1$$ equally represent the negative frequencies, as given by the fftshift command in MATLAB, Octave and Python scipy.signal.

Thus, we can circularly shift the N samples we are using in either time or frequency and get the same result in the other domain as long as we are careful about what that shift represents: A shift in time (delay) will be a linear phase versus frequency. A shift in frequency (frequency translation) will be a linear phase versus time. With that said, let's see how this adds clarity to the OP's question.

Specifically consider the property that a delay in time is a linear phase in frequency. This is clear if you consider observing a sine wave at the input to a loss-less cable and then the time delayed version of this same sine wave at the output of the cable and if we compared the phase between the two: we would see that as the frequency of the sine wave is increased, given the same time delay between input and output, the phase between the two will be linearly proportional to frequency.

A good take-away of this point to commit to memory is the effect of a one sample delay in time (commonly indicated by it's z-transform as $$z^{-1}$$). This will have a linear phase in frequency that goes from $$0$$ to $$-2\pi$$ as the frequency extends from DC to the sampling rate. We will see this specifically in the result of a DFT of a real signal as given by the graphic first introduced above, and as given by what becomes a complex result for the OP's case. That result has this specific linear phase applied, (and can be removed resulting in a real signal in frequency; to do this "unwrap" the phase first so that it extends beyond $$\pm \pi$$).

Thus we see the property of the Discrete Fourier Transform first introduced, and how "zero-phase" solutions are created with post-processing when we can violate causality, such as when we take the inverse Fourier Transform of a real signal to get what we would refer to as a "Zero-Phase" filter (see filtfilt in MATLAB, Octave and Python scipy.signal).

For a voice signal the expectation is to get the real and imaginary part of the same amplitude. i.e. random phase.

If you have a real signal, it can be decomposed as the superposition of an even and an odd signal $$f_e(t) + f_o(t)$$, where $$f_e(t) = f_e(-t)$$ and $$f_o(t) = -f_o(-t)$$, the real part of the FFT is connected to the even component, and the imaginary part is connected with the odd component. Also, the FFT will have Hermitian symmetry, the real part of the FFT of a real signal is even, the imaginary part of the FFT of a real signal is odd.