python - 不同时期的快速傅里叶变换(阶次分析)
问题描述
我正在尝试对来自以不同速度旋转的轴的加速度计数据进行快速傅立叶变换。
到目前为止我做了什么:
1:原始图在时域中,因此我进行了阶次分析(重新采样),得到了以下图:
该图显示了相对于幅度绘制的角旋转。
2:现在,使用以下代码完成了 FFT:
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
class FastFourierTransform:
# Amplitudes is a row vector
def __init__(self, amplitudes, t):
self.s = amplitudes
self.t = t
# Plotting in the input domain before fft
def plot_input(self):
plt.ylabel("Amplitude")
plt.xlabel("Shaft angle [Radians]")
plt.plot(self.t, self.s)
plt.margins(0)
plt.show()
'''
The second half of this array of fft sequence have similar frequencies
since the frequency is the absolute value of this value.
'''
def fft_transform(self):
mean_amplitude = np.mean(self.s)
self.s = self.s - mean_amplitude # Centering around 0
fft = np.fft.fft(self.s)
# We now have the fft for every timestep in out plot.
# T is the sample frequency in the data set
T = self.t[1] - self.t[0] # This is true when the period between each sample in the time waveform is equal
N = self.s.size # size of the amplitude vector
f = np.linspace(0, 1 / T, N, ) # start, stop, number of. 1 / T = frequency is the bigges freq
plt.ylabel("Amplitude")
plt.xlabel("Frequency [Hz]")
y = np.abs(fft)[:N // 2] * 1 /N
# Cutting away half of the fft frequencies.
sns.lineplot(f[:N // 2], y) # N // 2 is normalizing it
plt.margins(0)
plt.show()
time = f[:N // 2]
return fft, time
问题:
这个思维过程看起来正确吗?
说最终的 fft 图在频域中是否正确?从这个链接, http: //zone.ni.com/reference/en-XX/help/372416L-01/svtconcepts/svcompfftorder/,看起来最终的情节域应该在订单域中,但我不确定因为fft是从弧度域完成的。
Tomasz Barszcz的基于振动的风力涡轮机状态监测有这张图片
提前致谢。
解决方案
推荐阅读
- javascript - Apexcharts 如何将 xAxis 交换为 yAxis?
- python - 在python中设置记录集的批号
- c++ - c++ operator[] 可以用多个参数编译,有没有办法避免这种情况?
- c# - 为什么每次碰撞,而不仅仅是标记为 Enemy,都会激活这个 if 语句?Unity 中的 C#
- java - 如何逐行打印字母?
- javascript - CryptoJS,如何从 js 解密(可能重复)到 python salt,iv,密文
- java - Spring Boot azure Active Directory 多个客户端 ID
- regex - notepad++ REGEX 如何找到匹配的字符串并保留它(删除所有周围的文本)
- c# - 如何在 C# 控制台中的前几个字符之后忽略每个输入?
- .net-core - Swagger - 自定义请求正文