用python画函数图像

上代码

import numpy as np
import matplotlib.pyplot as plt
def  f(x):
    return x*x*x+2*x+1.2**x;

def plot_f():
    x = np.linspace(1,100,1000)
    y = f(x)

    # plt.figure()
    plt.plot(x,y)
    plt.grid()
    plt.show()

plot_f()

 

posted @ 2020-03-12 15:11  SunCY  阅读(615)  评论(0编辑  收藏  举报