这里需要 几个工具,paddle,numpy,还有画图工具maplibplot

不废话,直接上代码

import paddle
import numpy as np

import matplotlib.pyplot as plt

def get_data(x):
    c,r = x.shape
    y = np.sin(x*3.14)+1+(0.02*(2*np.random.rand(c,r)-1))
    return(y)

xs = np.arange(0,3,0.01).reshape(-1,1)
ys = get_data(xs)
xs = xs.astype('float32')
ys = ys.astype('float32')

plt.title("curve")
plt.plot(xs,ys)

plt.show()

运行结果

更多推荐

paddle 绘制曲线图