0
#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))
所以這是我的代碼到目前爲止插入一組數據,我得到了這麼多,但我被告知我有一個「整除或零模」,我有玩一玩,但我不能找到我的錯誤。使用三次樣條插值