Quasi 0 basic understanding FFT Fast Fourier Transform and its realization program (i) _fft

Source: Internet
Author: User

---------------------the preface to a nagging nonsense-------------------------------------------

The goal of this article: let the small partners not very understand DSP will use FFT (Fast Fourier transform), and know how to use the code to achieve FFT, superficial understanding, but for works.

Recently did the project to use the FFT, previously learned is not very clear, now used to make a decision to understand it well. In the Chinese website to find some information, found that the said is not very clear, or my level is too low to understand. Later or in the foreign website to find a talk about simple and easy to understand very grounded gas article. Here translated it, and added some of their own views. To facilitate the domestic small partners to learn ~

Why to say is ' Quasi 0 Foundation ', is to say you need to understand some basic signal science and mathematics knowledge (at least heard of Fourier transform, discrete digital signal, frequency domain analysis these concepts.) If you really don't even hear about it, well, this article can't help you, go left and wish you success ~

Almost forgot ~ Thank Alwatslearn website, the author is who did not find, I'm sorry.

Let's talk about this.

-----------------------------------the preface to the end of nagging nonsense----------dry goods start---------

Want to grasp the FFT thoroughly, before looking at the code, first of all to understand the mathematical principle of FFT, this article begins with the introduction of the mathematical principle of FFT, and then to discuss the implementation of the Code of FFT.

Some of the basics of signal processing may know that FFT (Fourier transform) is based on DFT (discrete Fourier transform). FFT can be said to be another version of the DfT, is based on the DfT faster, more suitable for computer operations, a Fourier transform. So, let's start with the DTF.

The main function of DTF is to convert time domain data into frequency domain data. DfT means that an infinite number of week term numbers is infinitely segmented. Its most basic formula is shown in Formula 1.

Formula 1

X (k) is the time domain signal that will be converted to the frequency domain (with the waveform of the horizontal axis)

The following are the basic concepts that need to be used in the DFT:

(The following concepts may be slightly abstract, difficult to understand, first look at some of the impressions, later in combination with examples should be understandable after)

1. Sampling rate (sampling RATE,SR). The meaning is the number of samples taken in a time period. For the sake of learning simplicity, we consider the sampling interval (sample Interval,si) to be equal.

2. Basic time (fundamental period,t). The time required to sample all. Also known as a window (Windows).

3. Basic frequency (fundamental frequency,f0). That is 1/t, the first wave frequency is F0, the second broadcast frequency 2*f0, the third wave frequency is 3*f0, and so on

4. Sample Quantity N

5. Nyquist Frequency FC. FC is the maximum frequency of the signal that can be sampled correctly according to the Nyquist sampling law, and if the signal exceeds this frequency, then the sampled signal will be distorted. Nyquist Sampling Law is the most advanced law in the signal theory (that is, the sampling frequency should be at least twice times the original signal), here do not do too much explanation, details can refer to Wiki, the law itself is very simple and easy to understand.

6. Euler formula (Euler ' s formula), the most basic formula of the plural concept. I'm sure everyone will be able to see Wikipedia for details.

7. The time domain signal to be performed for DFT, X (t).

8. In order to make the index expression more concise, the use of WN instead. In some places it is also called the twiddle fatctor (rotation factor).

To understand the basic definition, let's combine a simple example to find out what the DfT does.

For the sake of simplicity, we will sample a sinusoidal signal, the number of sample points is N (quantity of points), and then DFT. The concepts described above will be used in the process of DFT. In real life, the signal of DFT is generally much more complicated than the sinusoidal signal.

Figure 1


As shown in Figure 1, the sampled signal is a sine signal, the horizontal axis is the time, the longitudinal axis is amplitude, the red point is the sampling point (sampled points), the base time is T, and the sampling interval (sampling interval) is 2*PI/4. As you can see from the diagram, the original signal can be restored through these four sample points, in other words, although only 4 points are picked from an infinite number of points, the properties of the original sine signal can be reflected from these four points.

We also need to know the period of the sinusoidal signal being sampled so that we can calculate the frequency. In this example, our cycle is t,0.1s. So the signal frequency we sampled is 10Hz. One cycle sample four times, so our sample rate (sample rate) is 40Hz.

The discrete signals obtained after sampling are:

Before you can do a DFT, you need to consider the rotation factor first.

DFT formula, sampled four times

To transform with Euler's formula

The results obtained:

If the value of K continues to increase, the value will be recycled according to the order above. such as K=5 w=1, k=6 w=-j

Now add up the results.

DFT gets four frequencies of different points

Now let's analyze the results.

The value of each f (n) represents a value for a certain frequency. The frequency of each sampling point is the base frequency *n. In this example the base frequency is F0 (Hz), then the frequency of the first point is f0*0. It is also worth noting that the value of the result is a complex number, which has two parts, a real part and a imaginary part, and that the amplitude of the complex number is the root of the sum of the real part and the imaginary part, i.e. "sqrt (real*real+imaginary*imaginary)"

The following figure (Figure 2) shows the frequency spectrum that we draw from the results above

Figure 2

As you can see in Figure 1 and Figure 2, Figure 2 is a graph of the frequency domain, and the horizontal axis is the frequency. You can see from the diagram that there is a spike (nail) at 10Hz, which is consistent with our estimate because we are sampling a 10Hz sine signal. And in the picture in 30Hz there is a spike, this is what happened. Here we introduce the Nyquist sampling theorem will come in handy, according to the sampling theorem, our sampling frequency (saple rate) is 40Hz, said that all the frequencies greater than 20Hz are invalid, so the 30Hz spike in the figure is invalid.

Here we use a simple sine signal as an example, in real life the signal is usually more complex than the sinusoidal signal, and correspondingly, in its frequency domain there will be more spike such as the triangle wave shown in Figure 3.

Figure 3

The principle of DFT is basically these, the next chapter we began to learn FFT ~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.