英文:
How can I add the Gaussian fit function back to originlab?
问题
我需要为学校做一个项目,使用高斯函数适应多个峰值。问题是我不小心从峰值函数列表中删除了这个函数。这基本上是我看到的全部。我不知道如何将它添加回去,而且在谷歌上也没找到其他信息。也许是因为这不是人们通常做的事情。
当我点击"添加"按钮时,文件夹里什么都没有显示。
但是当我直接查看文件夹时,我看到函数就在那里。也许这是用于其他用途的高斯函数,而不是峰值拟合。有人知道我该如何解决这个问题吗?
英文:
I needed to do a project for school to fit multiple peaks using the Gaussian function. The problem is that I remove the function accidentally from the peak functions list.This is preaty much all am I seeing. I don't know how to add it back and I didn't find anything else on google. Maybe because this is not something people usually do.
enter image description here
When I press the "add" button I don't see anything in the folder.
enter image description here
But when I look directly in the folder I see the function right there. Maybe it is a Gaussian function for something else, not peak fit. Does anybody know how I can fix this?
enter image description here
答案1
得分: 0
尝试使用普通最小二乘OLS曲线拟合,在两个峰值之间插值一条线。
# 将数据拟合到高斯函数。
fit_func = lambda p, x: p[0]*np.exp(-0.5*((x-p[1])/p[2])**2) + p[3]
err_func = lambda p, x, y: fit_func(p, x) - y
p0 = [max_counts, max_location, sigma, baseline]
p, success = optimize.leastsq(err_func, p0[:], args=(x, y))
# 获取高斯函数的参数。
max_counts, max_location, sigma, baseline = p
英文:
try using ordinary least squares ols curve fitting to interpolate a line between the two peaks
# Fit the data to the gaussian function.
fit_func = lambda p, x: p[0]*np.exp(-0.5*((x-p[1])/p[2])**2) + p[3]
err_func = lambda p, x, y: fit_func(p, x) - y
p0 = [max_counts, max_location, sigma, baseline]
p, success = optimize.leastsq(err_func, p0[:], args=(x, y))
# Get the parameters of the Gaussian function.
max_counts, max_location, sigma, baseline = p
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论