f=np.loadtxt('Single Small Angle 1.txt',unpack=True,skiprows=2)
g=np.loadtxt('Single Small Angle 5.txt',unpack=True,skiprows=2)
x = f-g[:,:11944]
t=range(len(x))
m=math.log10(abs(x))
np.polyfit(t,m)
plt.plot(t,abs(x))
plt.show()
我只是不确定如何解决我的问题。它一直在说:
m=math.log10(abs(x))
TypeError: only length-1 arrays can be converted to Python scalars
TypeError: Don't feed native python lists into numpy functions that expect numpy arrays. Either convert your python list to a numpy array or package your python lists into a tuple.
Python numpy确实丢下了那个错误消息,该错误消息非常糟糕。