Python实现高斯曲线拟合
1.目的
针对光谱离散数据,寻峰完成后截取near峰值的数据,利用高斯拟合重绘单峰曲线,进而实现分峰功能
2.原理
3.代码
import numpy as np
from math import log, exp
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
from scipy import asarray as ar,exp
yOriginal = np.loadtxt('C:\\工作\数据.txt')
xOriginal = np.arange(len(yOriginal))
print(
Python实现高斯曲线拟合1.目的针对光谱离散数据,寻峰完成后截取near峰值的数据,利用高斯拟合重绘单峰曲线,进而实现分峰功能2.原理3.代码import numpy as npfrom math import log, expimport matplotlib.pyplot as pltfrom scipy.optimize import curve_fitfrom scipy import asarray as ar,exp # 将txt文件读入numpy数组yOrig