import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import torch.fft as fft df = pd.read_csv('train.csv') df=df.drop(['ID'],axis=1) nmp=df.to_numpy() feature=nmp[:-20,:-1] label=nmp[:-20,-1]#(210,240) feature=torch.fft.fft(torch.Tensor(feature)) feature=torch.abs(feature) feature=feature.detach().numpy() ax1 = plt.subplot(2,1,1) plt.sca(ax1) plt.plot(range(len(nmp[1,:-1])),feature[1,:]) ax2 = plt.subplot(2,1,2) plt.sca(ax2) plt.plot(range(len(nmp[1,:-1])),nmp[1,:-1]) plt.show()
标签:fft,显示,plt,nmp,torch,feature,频域,import,时域 From: https://www.cnblogs.com/hahaah/p/16941004.html