【发布时间】:2018-01-24 18:41:36
【问题描述】:
我有一个这样的数据文件
Frequencies -- 95.1444 208.5295 256.0966
IR Inten -- 4.5950 0.1425 2.4807
Frequencies -- 273.7203 424.4748 446.9433
IR Inten -- 0.6420 0.0001 0.9654
Frequencies -- 520.5846 561.6770 630.1851
IR Inten -- 8.8996 6.4944 0.4674
Frequencies -- 703.7315 767.1711 799.2923
IR Inten -- 23.7514 63.4507 15.9273
每个频率都与下面的IR强度相关,例如(频率= 95.1444/ IR Inten= 4.5950),(频率= 208,5295/ IR Inten= 0.1425)......等等。
我必须在每个频率上构建一个高斯曲线,其高度是最强峰的相对强度。所有这些曲线的总和应该是红外光谱的模型。
这里有一些提示:
高斯曲线是:
import math
y = a*math.exp(-(x-b)**2/(2*c*c))
在哪里
a: height of the peak
b: position of the center of the peak
c: controls the width of the peak
您可以按如下方式绘制函数:
import pylab
pylab.plot(xs,ys)
# xs is a list of x-values
# ys is a list of y-values
pylab.show()
【问题讨论】: