将拟合的曲线保存为xlsx文件,并保存参数
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import math
def plot_data(x, y):
# 绘制原始数据的散点图
plt.scatter(x, y)
plt.xlabel('x')
plt.ylabel('y')
plt.legend()
plt.show()
def fit_func(x, a, b,c,d,e):
# return a*x +b
return a*x**4 +b*x**3+c*x**2+d*x&