当前位置:网站首页>FFT物理意义: 1024点FFT就是1024个实数,实际进入fft的输入是1024个复数(虚部为0),输出也是1024个复数,有效的数据是前512个复数
FFT物理意义: 1024点FFT就是1024个实数,实际进入fft的输入是1024个复数(虚部为0),输出也是1024个复数,有效的数据是前512个复数
2022-04-23 19:23:00 【ToneChip】
2019.02.19更新为了方便简洁记住FFT,总结了一下两段来记录
1024点FFT中的1024是指的输入实数个数,但是FFT输入的一般是复数,也就是1024个复数.FFT输出也是1024个复数,其中只计算前512个复数
总结
N点FFT中的N是指的输入实数个数,但是FFT函数输入的一般是复数,也就是N个复数.FFT输出也是N个复数,其中只计算前N/2个复数
FFT物理意义
FFT是离散傅立叶变换的快速算法,可以将一个信号变换
到频域。从而分析信号的频域特征。常用于频谱分析。
时域信号直接通过ADC进行采样获得。
采样要点
- 采样频率要大于信号频率的两倍
- N个采样点,经过FFT之后,就可以得到N个点的FFT结果。为了方便进行FFT运算,通常N取2的整数次方。
结果意义
- 采样点数为N。那么FFT之后结果就是一个为N点的复数。每一个点就对应着一个频率点。
- 假设原始信号的峰值为A,那么FFT的结果的每个点(除了第一个点直流分量之外)的模值就是A的N/2倍。而第一个点就是直流分量,它的模值就是直流分量的N倍。
- 频率点对应FFT结果复数的夹角下的信号的相位。
- 第一个点表示直流分量(即0Hz),而最后一个点N的再下一个点(实际上这个点是不存在的,这里是假设的第N + 1个点,也可以看做是将第一个点分做两半分,另一半移到最后)则表示采样频率Fs,这中间被N - 1个点平均分成N等份,每个点的频率依次增加。例如某点n所表示的频率为:
Fn = (n - 1) * Fs / N
。Fn所能分辨到频率为为Fs/N,如果采样频率Fs为1024Hz,采样点数为1024点,则可以分辨到1Hz,每一点为1Hz。注意到0Hz是第一个点并非坐标原点如果要提高频率分辨力,则必须增加采样点数,也即采样时间。频率分辨率和采样时间是倒数关系。要提高频率分辨率,就需要增加采样点数,这在一些实际的应用中是不现实的,需要在较短的时间内完成分析。解决这个问题的方法有频率细分法,比较简单的方法是采样比较短时间的信号,然后在后面补充一定数量的0,使其长度达到需要的点数,再做FFT,这在一定程度上能够提高频率分辨力。具体的频率细分法可参考相关文献。
总结
假设FFT之后某点n用复数a+bi表示,那么这个复数的模就是An=根号a*a+b*b
,相位就是Pn=atan2(b,a)
,范围从-pi到pi。根据以上的结果,就可以计算出n点对应的信号的表达式为:
n = 1
A1 / N
n ≠ 1,且n <= N / 2
An / (N / 2) * cos(2 * pi * Fn * t + Pn)
即
2 * An / N * cos(2 * pi * Fn * t + Pn)。
实例
表达式
S = 2 // ①
+ 3.0 * cos(2 * pi * 50 * t - pi * 30 / 180) // ②
+ 1.5 * cos(2 * pi * 75 * t + pi * 90 / 180) // ③
信号① 2V的直流分量
信号② 频率50Hz、相位-30度、幅度3.0V的交流信号
信号③ 频率75Hz、相位+90度、幅度1.5V的交流信号
采样
采样频率 256Hz
采样点数 256点
根据Fn = (n - 1) * Fs / N
,第n个点的频率就是n - 1。可以知道三个信号分别在第1个点、第51个点、第76个点上出现峰值。其它各点应该接近0。
FFT计算
1点: 512 + 0i
2点: -2.6195E-14 - 1.4162E-13i
3点: -2.8586E-14 - 1.1898E-13i
50点:-6.2076E-13 - 2.1713E-12i
51点:332.55 - 192i
52点:-1.6707E-12 - 1.5241E-12i
75点:-2.2199E-13 - 1.0076E-12i
76点:3.4315E-12 + 192i
77点:-3.0263E-14 + 7.5609E-13i
计算幅度
根据An=根号a*a+b*b
计算模值
1点: 512 = 根号(512 * 512 + 0 * 0)
51点: 384 = 根号(332.55 * 332.55 + 192 * 192)
76点: 192 = 根号((3.4315E-12) * 3.4315E-12) + 192 * 192)
根据
n = 1
A1 / N
n ≠ 1,且n <= N / 2
An / (N / 2) * cos(2 * pi * Fn * t + Pn)
即
2 * An / N * cos(2 * pi * Fn * t + Pn)。
可以计算幅度
1点: 2.0 = A1 / N = 512 / 256
51点: 3.0 = An / (N / 2) = 384 / ( 256 / 2)
76点: 1.5 = An / (N / 2) = 192 / ( 256 / 2)
计算相位
根据Pn=atan2(b,a)
计算弧度相位
1点: 直流分量没有相位
51点: atan2(-192, 332.55) = -0.5236
76点: atan2(192, 3.4315E-12) = 1.5708
转换成角度
51点: 180 * (-0.5236) / pi = -30.0001
76点: 180 * (1.57080) / pi = +90.0002
参考文章Matlab例程
close all; %先关闭所有图片
Adc=2; %直流分量幅度
A1=3; %频率F1信号的幅度
A2=1.5; %频率F2信号的幅度
F1=50; %信号1频率(Hz)
F2=75; %信号2频率(Hz)
Fs=256; %采样频率(Hz)
P1=-30; %信号1相位(度)
P2=90; %信号相位(度)
N=256; %采样点数
t=[0:1/Fs:N/Fs]; %采样时刻
%信号
S=Adc+A1*cos(2*pi*F1*t+pi*P1/180)+A2*cos(2*pi*F2*t+pi*P2/180);
%显示原始信号
plot(S);
title('signal');
figure;
Y = fft(S,N); %做FFT变换
Ayy = (abs(Y)); %取模
plot(Ayy(1:N)); %显示原始的FFT模值结果
title('Frequency spectrum');
figure;
Ayy=Ayy/(N/2); %换算成实际的幅度
Ayy(1)=Ayy(1)/2;
F=([1:N]-1)*Fs/N; %换算成实际的频率值
plot(F(1:N/2),Ayy(1:N/2)); %显示换算后的FFT模值结果
title('Amplitude-frequency');
figure;
Pyy=[1:N/2];
for i=1:N/2
Pyy(i)=phase(Y(i)); %计算相位
Pyy(i)=Pyy(i)*180/pi; %换算为角度
end;
plot(F(1:N/2),Pyy(1:N/2)); %显示相位图
title('Phase, frequency');
个人Matlab例程
待完成
Freq = 1000;
Fs = 44100;
N = 44100;
t = linspace(0, 1, N);
x = sin(2 * pi * Freq * t);
y = fft(x);
subplot(2, 2, 1);
Crycle3N = ((3 / Freq) * Fs) + 1;
plot(1000 * t(1 : Crycle3N), x(1 : Crycle3N), "LineWidth", 3);
grid;
title('Frequency spectrum');
xlabel("Time in milliseconds");
ylabel("Signal amplitude");
subplot(2, 2, 2);
plot(abs(y(1 : (N / 2))), "LineWidth", 3);
grid;
xlabel("Frequency");
ylabel("Signal amplitude");
版权声明
本文为[ToneChip]所创,转载请带上原文链接,感谢
https://tonechip.blog.csdn.net/article/details/81392408
边栏推荐
- Using oes texture + glsurfaceview + JNI to realize player picture processing based on OpenGL es
- Problems caused by flutter initialroute and home
- Garbage collector and memory allocation strategy
- JS to get the local IP address
- Intuitive understanding of the essence of two-dimensional rotation
- openlayers draw矩形
- Customize the non slidable viewpage and how to use it
- js获取本机ip地址
- arcMap 发布切片服务
- js上传文件时控制文件类型和大小
猜你喜欢
An idea of rendering pipeline based on FBO
[报告] Microsoft :Application of deep learning methods in speech enhancement
Decompile and get the source code of any wechat applet - just read this (latest)
Wechat video extraction and receiving file path
为何PostgreSQL即将超越SQL Server?
RuntimeError: Providing a bool or integral fill value without setting the optional `dtype` or `out`
Oracle配置st_geometry
Audio signal processing and coding - 2.5.3 the discrete cosine transform
White screen processing method of fulter startup page
Partage de la conception de l'alimentation électrique de commutation et illustration des compétences en conception de l'alimentation électrique
随机推荐
[report] Microsoft: application of deep learning methods in speech enhancement
Summary of several relationships of UML class diagram
Hot reload debugging
为何PostgreSQL即将超越SQL Server?
No, some people can't do the National Day avatar applet (you can open the traffic master and earn pocket money)
arcgis js api dojoConfig配置
@Analysis of conditional on Web Application
Easy mock local deployment (you need to experience three times in a crowded time. Li Zao will do the same as me. Love is like a festival mock)
Convert string to JSON
ArcMap连接 arcgis server
MySQL syntax collation (2)
Wechat video extraction and receiving file path
Machine learning catalog
Some records used by VS2010
Application of DCT transform
The most detailed network counting experiment in history (2) -- rip experiment of layer 3 switch
Some speculation about the decline of adults' language learning ability
什么是消息队列
Openlayers 5.0 loading ArcGIS Server slice service
Keysight has chosen what equipment to buy for you