上一章讲到了如何利用python把时域信号变成频域信号,那么如果要看时频图该怎么办呢?
这里还是以实际应用作为例子,下面让我们来看看如何实现。
采用的是从PAK采集系统收集到的原始振动数据,为在涡轮增压器上面的加速度传感器信号,
导出成txt文件格式,然后利用python进行FFT变换。
首先用pandas导入原始文件
'''Fourtran'''
'''Author:jAEgerrr'''
'''2020-03-06'''
import matplotlib.pyplot as plt
from scipy import signal
import numpy as np
import pandas as pd
from matplotlib import cm
data=pd.read_table('./vibdata.txt',header=None,index_col=0,names=['time','acc'])
1/(data.index[1]-data.index[0])
acc=data['acc']
data.plot()
这里读取原始数据data有两列,左边索引列为时间序列,右边为采集的信号,即加速度。
通过区分时间间隔,1/(data.index[1]-data.index[0])&#x