他俩都是在60频率但是不清楚每个频率的振幅分布在哪。 import matplotlib.pyplot as plt import numpy as np import pandas as pd import torch import numpy as np df = pd.read_csv('train.csv') df=df.drop(['ID'],axis=1) nmp=df.to_numpy() feature=nmp[:,:-1] label=nmp[:,-1]#(210,240) feature=np.fft.fft(feature) feature=np.abs(feature)/240*2 w1=np.zeros(240) w2=np.zeros(240) for i in range(210): index=np.where(feature[i,:]==np.max(feature[i,:])) if label[i]==0: w1[index]=w1[index]+1 if label[i]==1: w2[index]=w2[index]+1 ax1 = plt.subplot(2,1,1) ax2 = plt.subplot(2,1,2) plt.sca(ax1) plt.scatter(range(240),w1) plt.sca(ax2) plt.scatter(range(240),w2) plt.show()
标签:index,plt,最大值,feature,索引,240,np,import,numpy From: https://www.cnblogs.com/hahaah/p/16941325.html