我在运行以下代码时收到错误:import matplotlib.pyplot as pltimport numpy as npm = 5E5q = .03p = .38e = math.ex = np.array (range(5))#factor = e ** ( - x ( p + q ) )#top = (1 - e ** ( - x ( p + q ) ))#bottom = (1 + (q / p) ( e ** ( - x ( p + q ) ) ))y = m * ( (1 - e ** ( - x * ( p + q ) )) / ((1 + (q / p) ( e ** ( - x * ( p + q ) ) ))) )plt.plot(x,y,label='y = x**2')plt.title("Testing")plt.xlabel("x axis")plt.ylabel("y axis")plt.grid(alpha = .4,linestyle='--')plt.plot(x,y,label='y=x**2')plt.legend()plt.show()我不明白错误TypeError:当我运行代码时,“float”对象不可调用。我尝试修改表达式等,但无济于事。任何帮助都会很棒。
1 回答

智慧大石
TA贡献1946条经验 获得超3个赞
(q / p) ( e ** ( - x * ( p + q ) ) )
您缺少一个运算符(q / p)
& ( e ** ( - x * ( p + q ) ) )
尝试:
y = m * ( (1 - e ** ( - x * ( p + q ) )) / ((1 + (q / p) * ( e ** ( - x * ( p + q ) ) ))) )
添加回答
举报
0/150
提交
取消