1 2 3 4 5 6 7 8 9 10 11 12 13
| import numpy as np import matplotlib.pyplot as plt
def func(x): return np.cos(2*np.pi*x)*np.exp(-x)+1 left_x = int(input("请输入下限值:")) right_x = int(input("请输入上限值:")) x = np.arange(left_x,right_x,0.01) y = func(x) plt.xlim(left_x,right_x) plt.ylim(-15000,25000) plt.plot(x,y) plt.show()
|