1.数据目标公式
G(x)=1000∗e−4∗ln2∗(x−91)2/0.52+0.3∗x2+2∗x+100G(x) = 1000 * e^{-4*ln2*(x-91)^2 / 0.5 ^2}+ 0.3 * {x}^2 + 2 * {x} + 100G(x)=1000∗e−4∗ln2∗(x−91)2/0.52+0.3∗x2+2∗x+100
2.代码
import numpy as npimport matplotlib.pyplot as pltdef generate_gauss():num_data = 71x = np.array(np.linspace(89, 93, num_data)).reshape(num_data, 1) # 产生包含噪声的数据y = 1000 * np.exp((-4 * np.log(2) * (91 - x) ** 2) / 0.5 ** 2) + 0.3 * x ** 2 + 2 * x + 100a = np.hstack((x, y))plt.scatter(x, y)plt.show()np.savetxt(r'C:\Users\gauss.txt', a, fmt='%f', delimiter='')if __name__ == '__main__':generate_gauss()