我正在绘制一个函数,这是我的代码:
import matplotlib.pyplot as plt
from pylab import log,xlabel,ylabel,title
u = 2510.
M = 2.8*(10**6)
m = 13.3*(10**3)
g = 9.81
x = arange(0,30,0.005)
v = (u*log(M/(M - (m*t))) - (g*t) #Function v(t) I am plotting
plt.plot(t,v)
xlim(0,30)
ylim(0,1000)
xlabel("Time measured from liftoff (s)")
ylabel("Velocity")
title("Speed v Time for a rocket in vertical motion")
plt.show()
我在
上遇到语法错误plt.plot(t,v)
这是为什么?我怎样才能纠正它?
答案 0 :(得分:2)
您的问题在:
v = (u*log(M/(M - (m*t))) - (g*t)
括号不匹配。