#plotted log values of Re and C(d)
import numpy as np
import matplotlib.pyplot as plt
plt.plot([np.log(0.2),np.log(2), np.log(20), np.log(200), np.log(2000), np.log(20000)], [np.log(103), np.log(13.9), np.log(2.72), np.log(0.800), np.log(0.401), np.log(0.433)], 'r-^')
plt.ylabel('C(D)')
plt.xlabel('Re')
plt.show()
#Then we Interpolate
import scipy
from scipy.interpolate import interpolate
scipy.interpolate.interp1d('x', 'y', kind='cubic')
import matplotlib.pyplot as plt
x = np.linspace[np.log(103), np.log(13.9), np.log(2.72), np.log(0.800), np.log(0.401), np.log(0.433)]
y = [np.log(0.2), np.log(2), np.log(20), np.log(200), np.log(2000), np.log(20000)]
f = interp1d(x, y, kind='cubic')
plt.plot(x, f(x))
所以这是我到目前为止插入一组数据的代码,我已经做到了这一点,但我被告知我有一个“整数除法或模数为零”,我玩过它,但我找不到我的错误。