回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>就像标题说的。我想符合这些要点。找到一个函数并检查我的函数将在哪个x处达到100。你知道吗</p>
<pre><code> import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
points = np.array([(3, 0), (7, 55), (14, 88)])
x = points[:,0]
y = points[:,1]
def func(x, p1,p2):
return p1*np.log(x)+p2
popt, pcov = curve_fit(func, x, y,p0=(1.0,10.2))
print popt
p1 = popt[0]
p2 = popt[1]
curvex=np.linspace(15,85,1000)
fit = func(curvex, p1, p2)
plt.plot(x, y, 'yo', label='data')
plt.plot(curvex,fit,'r', linewidth=5)
plt.plot(x,y,'x',label = 'Xsaved')
plt.show()
</code></pre>
<p><a href="https://i.stack.imgur.com/6vuGj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6vuGj.png" alt="enter image description here"/></a></p>
<ol>
<li><p>如何使函数通过点?(如果工作量过大,则不需要)</p></li>
<li><p>如何得到y=100的x值?</p></li>
</ol>
<p>谢谢!你知道吗</p>