actual frequency after fft

Fast Fourier Transform FFT

The function of fft in matlab is fft, which is a fast algorithm for discrete Fourier transform. The mathematical formula of fft is:
X [ k ] = 1 N ∑ n = 1 N x [ n ] ej 2 π kn NX[k] = \frac{1}{N}\sum_{n=1}^{N} x[n]e^{j\frac{2\pi kn}{N}}X[k]=N1n=1Nx[n]ejN2πkn
The sequence length of the original signal is NNN , the result after fft is stillNNN points. X[ k ] X[k]
after fftX [ k ] represents thekkthk frequency components. So how to convertkkDoes k correspond to the real frequency?

true frequency

The true frequency depends on two things:

  1. Get the original sequence x [ n ] x[n]The sampling frequency of x [ n ] ;
  2. Sampling points;

For example, the number of sampling points is 1000, and the sampling frequency is 1000Hz, then the real frequency is 1, 2, ..., 500Hz.
For example, the number of sampling points is 2000, and the sampling frequency is 1000Hz, then the real frequency is 0.5, 1, 1.5, ..., 500Hz.
It can be seen from this that the sampling rate remains unchanged, the more sampling points, the higher the frequency resolution.
The highest frequency component obtained after fft is 1/2 of the sampling frequency, the scale of frequency division (ie frequency resolution = sampling frequency/number of sampling points).
Suppose the true frequency is f ( k ) f(k)f ( k ) , the sampling frequency isfs f_sfs, the number of sampling points is NNN , the true frequency is:
f ( k ) = k ∗ ( fs N ) f(k)=k*(\frac{f_s}{N})f(k)=k(Nfs)

Simulation

In the following simulation program, the signal model is a multi-frequency point signal, the sampling rate is 1000, and the number of sampling points is 2000, so the frequency resolution is 1000/2000=0.5Hz, and the frequency values ​​are 0.5, 1, 1, 5,...500.
code show as below:

%% 信号包络,调频的调制过程展示
% 2022.5.26
% cleal all; close all; clc;
T = 2; % 总时间
fs = 1000; % 采样率
dt = 1/fs; % 采样间隔
t = 0:dt:T-dt; % 时间刻度向量
N = length(t); %序列长度
f1 = 100; % 频率分量1
f2 = 300; % 频率分量2
x = cos(2*pi*f1*t)+cos(2*pi*f2*t); % 基带信号
plot(t,x) % 绘图
X = fftshift(fft(x))*2/N; % fft
deltFrequency = fs/N; %频率分辨率
freqAxis = -fs/2:deltFrequency:fs/2-deltFrequency; % 频率正半轴
stem(freqAxis,abs(X));% 绘制幅度谱
axis([-501,501,0,1.3]); %控制坐标轴变量

The amplitude spectrum is as follows:
insert image description here

Figure 1. Amplitude Spectrum of Multi-Frequency Signal

Guess you like

Origin blog.csdn.net/wzz110011/article/details/124989420
FFT