append返回“none”列表

时间:2017-11-14 20:49:55

标签: python matplotlib

我正在尝试绘制图表。我的脚本最终返回一个空图,因为我的y-list(ly)结果是空的,但我不知道为什么:

from math import sin
from math import exp
def f(x):
    y = sin(4*x)*exp(-x**2+3*x)
    print(y)

from matplotlib import pyplot
xmin = 0
xmax = 5.0
npoints = 500
step_size = 0.01
lx = []
ly = []
for i in range(step_size):
    x = xmin+i*step_size
    lx.append(x)
    ly.append(f(x))

fig = pyplot.figure()
pyplot.plot(lx,ly)
pyplot.show()

任何人都可以帮我实际添加条目到我的y列表吗?

0 个答案:

没有答案