python 绘制函数图像

import numpy as np
import math
import matplotlib.pyplot as plt
plt.figure(1)
x=[]
y=[]
a=np.linspace(0,10,100)
def f1(x):
    y=1
    return y
def f2(x):
    y=1/(x*x+1)
    return y
def f3(x):
    y=math.sin(x)/(math.exp(x)+1)
    return y
for i in a:
    x.append(i)
    y.append(f3(i))
plt.plot(x,y)
plt.show()

 

你可能感兴趣的:(python)