Analysis of FFT and MATLAB experiment

Source: Internet
Author: User

FFT (Fast Fourier transformation), which is fast Fourier transform, is a fast algorithm for discrete Fourier transform (DFT).

The sampled digital signal, FFT transformation, n sampling point, after the FFT, you can get the FFT results of n points. In order to facilitate the FFT operation, usually n takes 2 of the entire number of times.

Hypothetical signal:

S=2+3*cos (2*pi*50*t-pi*30/180) +1.5*cos (2*pi*75*t+pi*90/180)

It contains: 2V of DC component

AC signal with a frequency of 50Hz and a phase of 30 degrees and a amplitude of 3V

AC signal with a frequency of 75Hz, a phase of 90 degrees, and a amplitude of 1.5V

Assuming that the signal is sampled at a sampling frequency of FS (200HZ), the Signal frequency f (0hz,50hz,75hz) and the number of samples is n (256), then the result of the FFT is a complex number of N (256) points. Each point corresponds to a frequency point. There are n (256) frequency points, the first point represents the DC component (0HZ), the n+1 point (not present, the fact that the last point is the No. 256) represents the sampling frequency of FS (200HZ), n intervals split the sampling frequency FS, each point frequency increases sequentially. The frequency represented by a point n is: fn= (n-1) *fs/n.

Point n is (1,2,3,4, 256) The corresponding frequency is

(0,200/256,2*200/256,3*200/256,.......... 127*200/256) HZ.

As can be seen from the above formula, FN can distinguish between the frequency of fs/n (200/256), that is, the two-point interval 200/256.

If the sampling frequency of FS is 1024Hz and the sample count is 1024 points, you can tell the 1Hz. 1024Hz sampling rate sampling 1024 points, just 1 seconds, that is, sampling 1 seconds of time signal and do the FFT, then the results can be analyzed to 1Hz, if the sample 2 seconds time signal and do FFT, the results can be analyzed to 0.5Hz. If you want to increase the frequency resolution, you must increase the number of sampling points, which is the sampling time. Frequency resolution and sampling time are reciprocal relationships.

To continue back to the example, there are three frequency points, 0hz,50hz,75hz, which should be at point N (1,65,97) at which the frequency represented (0,64*200/256,96*200/256) is (0,50,75) on the peak. Combined with MATLAB experiment to get these values, the relationship between peak and original signal is analyzed synthetically.

clf;fs=200; n=256; % sampling frequency and data points n= (0:n-1); t=n/fs; % Time Series S=2+3*cos (2*pi*50*t-pi*30/180) +1.5*cos (2*pi*75*t+pi*90/180); % Signal Y=fft (s,n); % Fast Fourier transformation of the signal mag=abs (y); The amplitude f=n*fs/n after Fourier transformation is obtained; % frequency sequence subplot (2,1,1), Plot (F,MAG); % plots amplitude xlabel (' frequency/hz ') with frequency variation, ylabel (' amplitude '), title (' 200 sampling frequency '), grid on;subplot (2,1,2), Plot (N,MAG); % plot amplitude xlabel (' frequency point ') with frequency variation, ylabel (' amplitude '); title (' 256 data points '); grid on;

 

Get the data from point 1,65,97. no.1:512.000000000001

No.65:332.553755053224-192.000000000001i

No.97:2.40097106720006e-12 + 192.000000000000i

Combined data available: calculates the amplitude of three points: 1 points 512 65 points 384 97 points 192

The analysis data can be: The DC component is 512/n=512/256=2;
The amplitude of the 50Hz signal is: 384/(N/2) =384/(256/2) = 3;

The amplitude of the 75Hz signal is 192/(N/2) =192/(256/2) = 1.5. It can be seen that the amplitude from the spectrum analysis is correct.

Calculate three-point phase information: The DC signal has no phase information; 65 points: arctan (-192, 332.55) =-0.5236; 97 points: arctan (192, 2.4e-12) =1.5708

Units for radians converted to angle: 65 points: 180* ( -0.5236)/pi=-30.0001; 97 points: 180*1.5708/pi=90.0002

Summary: Assuming that the FFT after a certain point n is represented by a complex number a+bi, then the modulus of the complex is an=sqrt (A*A+B*B), the phase is Pn=arctan (b,a). Based on the above results, it is possible to calculate the expression of the corresponding signal of N point (n≠1, and N<=N/2): an/(N/2) *cos (2*PI*FN*T+PN), i.e. 2*an/n*cos (2*PI*FN*T+PN). For the n=1 point signal, is the DC component, the amplitude is a1/n.

Analysis of FFT and MATLAB experiment

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.