import numpy as np
import matplotlib.pyplot as plt
def oriFunc(x):
y = np.exp(-x) * np.sin(10*x)
return y
def traFunc(x,sigma=0.03):
y = oriFunc(x) + np.random.normal(0, sigma, np.array(x).size)
return y
xBound = (0,3)
number = 500
X = np.linspace(*xBound,num=number)
Y_0 = traFunc(X)
Y_1 = oriFunc(X)
print(X.shape)
print(Y_1.shape)
print(Y_1)
plt.plot(X,Y_1,c="r",lw=4)
plt.scatter(x=X,y=Y_0,c='g')
plt.show()