layout: post title: 使用gnuplot进行光谱展宽和拟合 categories:
在光谱数据的处理方面, 有两类常见任务:
这两类任务都要涉及光谱中单个峰的数学表达式, 一般称其为线型函数. 基本的线型函数有两类;
洛伦兹线型
$$g_L(ν,γ_L)={γ_L/π}{1/ν^2+γ_L^2}$$
半峰半宽 $γ_L$, 半峰全宽 $2γ_L$
高斯线型, 也称多普勒线型
$$g_G(ν,σ)={1/√{2π}σ}\exp(-{ν^2/2σ^2}), σ={γ_G/√{2㏑2} }$$
半峰半宽 $γ_G=√{2㏑2}σ$, 半峰全宽 $2γ_G$
线型函数实际上对应于数学上所言的概率密度分布函数, 因此, 也可以将其称为分布. 洛伦兹分布物理上常用, 数学上则称为柯西分布. 高斯分布也就是正态分布. 这两种分布都是t分布的特例, 前者为自由度为1的t分布, 后者为自由度趋向无穷大的t分布.
洛伦兹线型来源于光谱的自然增宽和压力增宽, 表明体系内部具有指数衰减过程. 高斯线型来自多普勒效应, 这也是常称其为多普勒线型的原因. 这种增宽的原因在于温度非零时分子的速度具有麦克斯韦分布(类似高斯分布). 实际条件下测得的光谱是这两种线型函数共同作用的结果, 可写为卷积的形式, 所对应的线型称为Voigt函数. 这个函数为一个积分, 不存在简单的表达式, 计算比较麻烦, 所以除非必要, 一般不会用它进行光谱展宽. 但有时单独用洛伦兹展宽或高斯展宽效果不好, 为此, 又提出了一种赝Voigt函数来近似Voigt函数, 它是洛伦兹和高斯的线性组合, 计算简单, 所以常被用来作为效果稍好些的线型函数.
因为Voigt函数在光谱领域非常重要, 所以有大量论文讨论如何快速精确地计算其值. 各种科学计算程序也大多支持Voigt函数的计算. 目前常用的是libcert
函数库, 这也是gnuplot计算Voigt函数所用的方法. Python中也有相应的Voigt实现.
我以前写过简单的高斯, 洛伦兹, 赝Voigt展宽脚本, 但一直没有实现Voigt展宽, 因为自己写代码计算Voigt函数并没那么简单. 最近我发现Windows下的gnuplot 5.4自带了Voigt函数, 所以觉得没有必要再编译libcert
或编写Voigt函数了, 可以借助gnuplot实现一个比较通用的光谱展宽方案.
先看看gnuplot中VP
函数的图像, 并与洛伦兹函数, 高斯函数对比一下, 获得些直观印象.
可以看到, 在归一化的情况下, 高斯函数高瘦, 衰减更快, 洛伦兹函数则具有肥尾特征. VP
函数在σ=0, γ=0时分别趋近于洛伦兹函数和高斯函数.
在半峰宽相同的条件下, VP
函数的表现则有不同, 这是有些误解产生的原因, 具体讨论的可以参考论文A Common Misunderstanding about the Voigt Line Profile以及Comments on “A Common Misunderstanding about the Voigt Line Profile”. 将下面的图与上面的进行对比, 就可以发现其中的区别.
光谱展宽的数学比较简单. 假定我们有离散的一系列峰位置和峰高, $c_i, h_i, i=1,⋯,n$, 在每个峰的中心放置一个线型函数$h_i f(ν)$, 然后将所有线型函数的值累加起来作为连续光谱的值:
$$g(ν)=∑_{i=1}^n h_i f(ν-c_i)$$
下面是两个示例. 第一个是苯的红外光谱, 因为分子的对称性较高, 非零强度的频率较少.
<table class="highlighttable"><th colspan="2" style="text-align:left">vp-3.png</th><tr><td><div class="linenodiv" style="background-color: #f0f0f0; padding-right: 10px"><pre style="line-height:125%"> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321</pre></div></td><td class="code"><div class="highlight"><pre style="line-height:125%"><span></span><span style="#FF0000">$ben</span> <span style="#FF0000"><<EOD</span> <span style="#FF0000">411.52</span> <span style="#FF0000">0.0139</span> <span style="#FF0000">412.28</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">623.36</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">623.88</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">687.17</span> <span style="#FF0000">129.9979</span> <span style="#FF0000">727.19</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">869.06</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">874.66</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">996.19</span> <span style="#FF0000">0.0196</span> <span style="#FF0000">1001.05</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1023.49</span> <span style="#FF0000">0.0009</span> <span style="#FF0000">1025.07</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1025.25</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1068.62</span> <span style="#FF0000">7.2319</span> <span style="#FF0000">1071.69</span> <span style="#FF0000">7.0255</span> <span style="#FF0000">1179.01</span> <span style="#FF0000">0.0018</span> <span style="#FF0000">1203.21</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1210.16</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1340.03</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1382.68</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1519.97</span> <span style="#FF0000">7.8011</span> <span style="#FF0000">1524.40</span> <span style="#FF0000">7.9705</span> <span style="#FF0000">1666.82</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">1667.35</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">3185.61</span> <span style="#FF0000">0.0034</span> <span style="#FF0000">3195.88</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">3196.31</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">3212.36</span> <span style="#FF0000">34.2590</span> <span style="#FF0000">3212.85</span> <span style="#FF0000">34.9293</span> <span style="#FF0000">3223.34</span> <span style="#FF0000">0.0000</span> <span style="#FF0000">EOD</span> <span style="#FF0000">$pro</span> <span style="#FF0000"><<EOD</span> <span style="#FF0000">5.5703</span> <span style="#FF0000">0.2248</span> <span style="#FF0000">8.202</span> <span style="#FF0000">0.0517</span> <span style="#FF0000">11.1187</span> <span style="#FF0000">0.1945</span> <span style="#FF0000">12.4887</span> <span style="#FF0000">0.0312</span> <span style="#FF0000">14.7264</span> <span style="#FF0000">0.2752</span> <span style="#FF0000">20.8601</span> <span style="#FF0000">0.9193</span> <span style="#FF0000">26.9303</span> <span style="#FF0000">0.6772</span> <span style="#FF0000">30.9304</span> <span style="#FF0000">1.9412</span> <span style="#FF0000">34.0546</span> <span style="#FF0000">1.6479</span> <span style="#FF0000">34.6674</span> <span style="#FF0000">1.2732</span> <span style="#FF0000">39.6549</span> <span style="#FF0000">1.9459</span> <span style="#FF0000">42.5091</span> <span style="#FF0000">5.699</span> <span style="#FF0000">47.2868</span> <span style="#FF0000">2.9254</span> <span style="#FF0000">49.6395</span> <span style="#FF0000">6.3822</span> <span style="#FF0000">50.7001</span> <span style="#FF0000">2.3203</span> <span style="#FF0000">56.0899</span> <span style="#FF0000">3.7654</span> <span style="#FF0000">63.9532</span> <span style="#FF0000">6.0518</span> <span style="#FF0000">70.2859</span> <span style="#FF0000">0.1166</span> <span style="#FF0000">75.8429</span> <span style="#FF0000">2.1368</span> <span style="#FF0000">77.092</span> <span style="#FF0000">1.9241</span> <span style="#FF0000">78.465</span> <span style="#FF0000">5.9527</span> <span style="#FF0000">80.969</span> <span style="#FF0000">3.1261</span> <span style="#FF0000">86.7711</span> <span style="#FF0000">2.9239</span> <span style="#FF0000">94.2281</span> <span style="#FF0000">0.0847</span> <span style="#FF0000">96.7878</span> <span style="#FF0000">10.0573</span> <span style="#FF0000">102.5753</span> <span style="#FF0000">2.2876</span> <span style="#FF0000">103.5022</span> <span style="#FF0000">13.5716</span> <span style="#FF0000">109.5904</span> <span style="#FF0000">4.1824</span> <span style="#FF0000">117.5981</span> <span style="#FF0000">1.4245</span> <span style="#FF0000">120.7254</span> <span style="#FF0000">9.0271</span> <span style="#FF0000">127.1606</span> <span style="#FF0000">2.6787</span> <span style="#FF0000">131.1905</span> <span style="#FF0000">11.464</span> <span style="#FF0000">146.7241</span> <span style="#FF0000">17.3003</span> <span style="#FF0000">148.9796</span> <span style="#FF0000">5.2004</span> <span style="#FF0000">151.8352</span> <span style="#FF0000">4.1021</span> <span style="#FF0000">164.6458</span> <span style="#FF0000">2.014</span> <span style="#FF0000">168.4281</span> <span style="#FF0000">1.5959</span> <span style="#FF0000">178.56</span> <span style="#FF0000">1.2548</span> <span style="#FF0000">179.8289</span> <span style="#FF0000">1.3345</span> <span style="#FF0000">192.0131</span> <span style="#FF0000">18.7003</span> <span style="#FF0000">207.8927</span> <span style="#FF0000">5.8878</span> <span style="#FF0000">211.2551</span> <span style="#FF0000">4.0618</span> <span style="#FF0000">214.0112</span> <span style="#FF0000">5.7298</span> <span style="#FF0000">221.5261</span> <span style="#FF0000">27.1325</span> <span style="#FF0000">225.232</span> <span style="#FF0000">7.3722</span> <span style="#FF0000">242.6048</span> <span style="#FF0000">9.2672</span> <span style="#FF0000">266.769</span> <span style="#FF0000">9.7515</span> <span style="#FF0000">277.6434</span> <span style="#FF0000">13.3218</span> <span style="#FF0000">284.3466</span> <span style="#FF0000">12.0448</span> <span style="#FF0000">296.2707</span> <span style="#FF0000">27.5914</span> <span style="#FF0000">313.9051</span> <span style="#FF0000">2.5382</span> <span style="#FF0000">326.4214</span> <span style="#FF0000">0.8269</span> <span style="#FF0000">331.7138</span> <span style="#FF0000">8.9124</span> <span style="#FF0000">334.2993</span> <span style="#FF0000">3.4369</span> <span style="#FF0000">340.2758</span> <span style="#FF0000">15.4909</span> <span style="#FF0000">360.3065</span> <span style="#FF0000">0.3587</span> <span style="#FF0000">372.9981</span> <span style="#FF0000">1.7383</span> <span style="#FF0000">375.1391</span> <span style="#FF0000">2.7505</span> <span style="#FF0000">395.5045</span> <span style="#FF0000">10.3585</span> <span style="#FF0000">396.1989</span> <span style="#FF0000">7.1265</span> <span style="#FF0000">400.5555</span> <span style="#FF0000">28.8306</span> <span style="#FF0000">409.9106</span> <span style="#FF0000">34.5589</span> <span style="#FF0000">432.7897</span> <span style="#FF0000">5.0126</span> <span style="#FF0000">455.7656</span> <span style="#FF0000">72.503</span> <span style="#FF0000">463.0265</span> <span style="#FF0000">95.8982</span> <span style="#FF0000">469.9515</span> <span style="#FF0000">22.4316</span> <span style="#FF0000">485.0086</span> <span style="#FF0000">61.404</span> <span style="#FF0000">486.3107</span> <span style="#FF0000">144.6949</span> <span style="#FF0000">491.2587</span> <span style="#FF0000">41.7086</span> <span style="#FF0000">565.8919</span> <span style="#FF0000">9.448</span> <span style="#FF0000">567.6956</span> <span style="#FF0000">27.495</span> <span style="#FF0000">601.6105</span> <span style="#FF0000">40.0251</span> <span style="#FF0000">616.9299</span> <span style="#FF0000">17.9848</span> <span style="#FF0000">619.2627</span> <span style="#FF0000">105.0766</span> <span style="#FF0000">630.8975</span> <span style="#FF0000">17.8575</span> <span style="#FF0000">658.5038</span> <span style="#FF0000">69.1035</span> <span style="#FF0000">664.4005</span> <span style="#FF0000">4.2228</span> <span style="#FF0000">669.5269</span> <span style="#FF0000">70.6619</span> <span style="#FF0000">681.0125</span> <span style="#FF0000">92.2443</span> <span style="#FF0000">696.3436</span> <span style="#FF0000">11.7463</span> <span style="#FF0000">700.3316</span> <span style="#FF0000">56.5851</span> <span style="#FF0000">701.3512</span> <span style="#FF0000">28.4417</span> <span style="#FF0000">710.7345</span> <span style="#FF0000">35.8959</span> <span style="#FF0000">714.5113</span> <span style="#FF0000">6.6981</span> <span style="#FF0000">716.9605</span> <span style="#FF0000">30.2688</span> <span style="#FF0000">720.5791</span> <span style="#FF0000">47.7707</span> <span style="#FF0000">732.277</span> <span style="#FF0000">31.6282</span> <span style="#FF0000">741.0209</span> <span style="#FF0000">56.6437</span> <span style="#FF0000">747.9012</span> <span style="#FF0000">12.4558</span> <span style="#FF0000">750.3384</span> <span style="#FF0000">4.3337</span> <span style="#FF0000">767.4022</span> <span style="#FF0000">18.4507</span> <span style="#FF0000">782.7754</span> <span style="#FF0000">3.1596</span> <span style="#FF0000">790.3709</span> <span style="#FF0000">33.9786</span> <span style="#FF0000">808.49</span> <span style="#FF0000">3.1682</span> <span style="#FF0000">836.5271</span> <span style="#FF0000">23.3033</span> <span style="#FF0000">863.5872</span> <span style="#FF0000">7.3729</span> <span style="#FF0000">864.7526</span> <span style="#FF0000">10.9439</span> <span style="#FF0000">881.4292</span> <span style="#FF0000">11.6686</span> <span style="#FF0000">905.2745</span> <span style="#FF0000">81.3366</span> <span style="#FF0000">909.3038</span> <span style="#FF0000">13.0176</span> <span style="#FF0000">936.6016</span> <span style="#FF0000">35.3285</span> <span style="#FF0000">938.4601</span> <span style="#FF0000">64.7013</span> <span style="#FF0000">944.148</span> <span style="#FF0000">97.6404</span> <span style="#FF0000">961.2511</span> <span style="#FF0000">34.9923</span> <span style="#FF0000">961.47</span> <span style="#FF0000">29.2459</span> <span style="#FF0000">1000.0235</span> <span style="#FF0000">3.5754</span> <span style="#FF0000">1006.7099</span> <span style="#FF0000">1.7483</span> <span style="#FF0000">1016.3939</span> <span style="#FF0000">7.4102</span> <span style="#FF0000">1023.1448</span> <span style="#FF0000">1.9533</span> <span style="#FF0000">1025.4377</span> <span style="#FF0000">2.7167</span> <span style="#FF0000">1064.4731</span> <span style="#FF0000">13.3154</span> <span style="#FF0000">1069.9063</span> <span style="#FF0000">12.2305</span> <span style="#FF0000">1071.8959</span> <span style="#FF0000">22.7919</span> <span style="#FF0000">1073.7106</span> <span style="#FF0000">12.824</span> <span style="#FF0000">1077.035</span> <span style="#FF0000">3.0798</span> <span style="#FF0000">1087.8828</span> <span style="#FF0000">24.381</span> <span style="#FF0000">1088.7724</span> <span style="#FF0000">0.5369</span> <span style="#FF0000">1091.3019</span> <span style="#FF0000">7.156</span> <span style="#FF0000">1092.6817</span> <span style="#FF0000">0.9176</span> <span style="#FF0000">1096.0523</span> <span style="#FF0000">3.5179</span> <span style="#FF0000">1106.5754</span> <span style="#FF0000">12.0345</span> <span style="#FF0000">1110.7173</span> <span style="#FF0000">15.6929</span> <span style="#FF0000">1116.1719</span> <span style="#FF0000">25.9462</span> <span style="#FF0000">1127.6926</span> <span style="#FF0000">5.684</span> <span style="#FF0000">1128.2485</span> <span style="#FF0000">10.4408</span> <span style="#FF0000">1135.2589</span> <span style="#FF0000">9.0076</span> <span style="#FF0000">1135.3634</span> <span style="#FF0000">19.894</span> <span style="#FF0000">1170.9492</span> <span style="#FF0000">12.6672</span> <span style="#FF0000">1171.5141</span> <span style="#FF0000">7.1377</span> <span style="#FF0000">1176.381</span> <span style="#FF0000">14.6126</span> <span style="#FF0000">1185.3512</span> <span style="#FF0000">14.374</span> <span style="#FF0000">1192.013</span> <span style="#FF0000">10.5838</span> <span style="#FF0000">1203.5899</span> <span style="#FF0000">140.7856</span> <span style="#FF0000">1204.1205</span> <span style="#FF0000">168.3034</span> <span style="#FF0000">1219.4349</span> <span style="#FF0000">16.6149</span> <span style="#FF0000">1243.2615</span> <span style="#FF0000">72.2718</span> <span style="#FF0000">1244.3306</span> <span style="#FF0000">19.7603</span> <span style="#FF0000">1249.9352</span> <span style="#FF0000">16.8338</span> <span style="#FF0000">1253.7756</span> <span style="#FF0000">4.2009</span> <span style="#FF0000">1257.1176</span> <span style="#FF0000">12.43</span> <span style="#FF0000">1258.2583</span> <span style="#FF0000">10.9626</span> <span style="#FF0000">1274.3982</span> <span style="#FF0000">8.9235</span> <span style="#FF0000">1277.0126</span> <span style="#FF0000">73.3254</span> <span style="#FF0000">1294.9685</span> <span style="#FF0000">25.9155</span> <span style="#FF0000">1297.3158</span> <span style="#FF0000">1.4366</span> <span style="#FF0000">1297.5511</span> <span style="#FF0000">10.0741</span> <span style="#FF0000">1301.119</span> <span style="#FF0000">18.5913</span> <span style="#FF0000">1313.3604</span> <span style="#FF0000">14.4705</span> <span style="#FF0000">1314.5702</span> <span style="#FF0000">25.6698</span> <span style="#FF0000">1327.0457</span> <span style="#FF0000">11.3781</span> <span style="#FF0000">1348.8651</span> <span style="#FF0000">65.0611</span> <span style="#FF0000">1360.6187</span> <span style="#FF0000">26.1801</span> <span style="#FF0000">1365.4324</span> <span style="#FF0000">18.2422</span> <span style="#FF0000">1365.9126</span> <span style="#FF0000">14.7917</span> <span style="#FF0000">1371.9704</span> <span style="#FF0000">21.2766</span> <span style="#FF0000">1372.2487</span> <span style="#FF0000">181.1006</span> <span style="#FF0000">1398.991</span> <span style="#FF0000">84.3235</span> <span style="#FF0000">1408.7975</span> <span style="#FF0000">48.6287</span> <span style="#FF0000">1415.7099</span> <span style="#FF0000">129.5311</span> <span style="#FF0000">1428.2345</span> <span style="#FF0000">6.1065</span> <span style="#FF0000">1429.7462</span> <span style="#FF0000">51.4848</span> <span style="#FF0000">1443.1475</span> <span style="#FF0000">93.2618</span> <span style="#FF0000">1452.4158</span> <span style="#FF0000">84.7856</span> <span style="#FF0000">1459.1361</span> <span style="#FF0000">12.9864</span> <span style="#FF0000">1459.7117</span> <span style="#FF0000">10.1549</span> <span style="#FF0000">1468.7118</span> <span style="#FF0000">58.5782</span> <span style="#FF0000">1489.0287</span> <span style="#FF0000">37.4598</span> <span style="#FF0000">1490.1846</span> <span style="#FF0000">28.3128</span> <span style="#FF0000">1502.2183</span> <span style="#FF0000">24.6394</span> <span style="#FF0000">1518.0248</span> <span style="#FF0000">68.7913</span> <span style="#FF0000">1528.3239</span> <span style="#FF0000">54.046</span> <span style="#FF0000">1529.8767</span> <span style="#FF0000">12.7381</span> <span style="#FF0000">1546.5526</span> <span style="#FF0000">4.6335</span> <span style="#FF0000">1558.1716</span> <span style="#FF0000">32.5112</span> <span style="#FF0000">1558.2001</span> <span style="#FF0000">35.6352</span> <span style="#FF0000">1562.1631</span> <span style="#FF0000">39.1299</span> <span style="#FF0000">1566.4315</span> <span style="#FF0000">88.1398</span> <span style="#FF0000">1592.0727</span> <span style="#FF0000">64.9987</span> <span style="#FF0000">1603.7566</span> <span style="#FF0000">29.2215</span> <span style="#FF0000">1605.9611</span> <span style="#FF0000">12.4568</span> <span style="#FF0000">1606.14</span> <span style="#FF0000">16.5949</span> <span style="#FF0000">1608.7598</span> <span style="#FF0000">17.4199</span> <span style="#FF0000">1608.9714</span> <span style="#FF0000">45.8923</span> <span style="#FF0000">1611.0471</span> <span style="#FF0000">49.0506</span> <span style="#FF0000">1612.5791</span> <span style="#FF0000">29.7291</span> <span style="#FF0000">1622.6447</span> <span style="#FF0000">34.6206</span> <span style="#FF0000">1625.8612</span> <span style="#FF0000">12.5778</span> <span style="#FF0000">1628.0334</span> <span style="#FF0000">1.641</span> <span style="#FF0000">1629.0302</span> <span style="#FF0000">159.3846</span> <span style="#FF0000">1629.2513</span> <span style="#FF0000">3.1434</span> <span style="#FF0000">1630.6931</span> <span style="#FF0000">1.4976</span> <span style="#FF0000">1631.9014</span> <span style="#FF0000">25.1015</span> <span style="#FF0000">1633.3015</span> <span style="#FF0000">6.605</span> <span style="#FF0000">1633.9271</span> <span style="#FF0000">11.1993</span> <span style="#FF0000">1641.0299</span> <span style="#FF0000">9.9203</span> <span style="#FF0000">1641.7938</span> <span style="#FF0000">29.8011</span> <span style="#FF0000">1649.826</span> <span style="#FF0000">19.5962</span> <span style="#FF0000">1650.9025</span> <span style="#FF0000">12.7789</span> <span style="#FF0000">1676.6164</span> <span style="#FF0000">135.773</span> <span style="#FF0000">1690.6269</span> <span style="#FF0000">367.0851</span> <span style="#FF0000">1697.1001</span> <span style="#FF0000">72.4277</span> <span style="#FF0000">1697.3751</span> <span style="#FF0000">518.5653</span> <span style="#FF0000">1700.597</span> <span style="#FF0000">311.6447</span> <span style="#FF0000">1703.253</span> <span style="#FF0000">234.2651</span> <span style="#FF0000">1708.5578</span> <span style="#FF0000">1.8341</span> <span style="#FF0000">1726.4863</span> <span style="#FF0000">264.9281</span> <span style="#FF0000">1731.3218</span> <span style="#FF0000">153.7944</span> <span style="#FF0000">1802.943</span> <span style="#FF0000">78.9193</span> <span style="#FF0000">1811.1822</span> <span style="#FF0000">33.7786</span> <span style="#FF0000">1821.9025</span> <span style="#FF0000">95.8968</span> <span style="#FF0000">1897.9733</span> <span style="#FF0000">507.8488</span> <span style="#FF0000">1908.7425</span> <span style="#FF0000">740.5449</span> <span style="#FF0000">1912.1115</span> <span style="#FF0000">76.4197</span> <span style="#FF0000">1948.6744</span> <span style="#FF0000">298.6536</span> <span style="#FF0000">1952.2258</span> <span style="#FF0000">190.9105</span> <span style="#FF0000">1964.7986</span> <span style="#FF0000">232.6757</span> <span style="#FF0000">3222.6301</span> <span style="#FF0000">3.2267</span> <span style="#FF0000">3227.4149</span> <span style="#FF0000">1.4081</span> <span style="#FF0000">3233.4723</span> <span style="#FF0000">2.4421</span> <span style="#FF0000">3237.1163</span> <span style="#FF0000">41.8467</span> <span style="#FF0000">3237.5387</span> <span style="#FF0000">9.6233</span> <span style="#FF0000">3242.6788</span> <span style="#FF0000">38.4305</span> <span style="#FF0000">3245.535</span> <span style="#FF0000">31.3443</span> <span style="#FF0000">3251.8003</span> <span style="#FF0000">5.6615</span> <span style="#FF0000">3255.9425</span> <span style="#FF0000">3.5297</span> <span style="#FF0000">3260.8563</span> <span style="#FF0000">16.8681</span> <span style="#FF0000">3276.8333</span> <span style="#FF0000">1.83</span> <span style="#FF0000">3283.2845</span> <span style="#FF0000">7.7968</span> <span style="#FF0000">3288.5065</span> <span style="#FF0000">10.6577</span> <span style="#FF0000">3294.0036</span> <span style="#FF0000">12.0576</span> <span style="#FF0000">3296.7166</span> <span style="#FF0000">7.5492</span> <span style="#FF0000">3308.7381</span> <span style="#FF0000">1.9153</span> <span style="#FF0000">3309.4265</span> <span style="#FF0000">2.9439</span> <span style="#FF0000">3312.3182</span> <span style="#FF0000">25.3147</span> <span style="#FF0000">3317.6555</span> <span style="#FF0000">21.2113</span> <span style="#FF0000">3317.895</span> <span style="#FF0000">20.889</span> <span style="#FF0000">3318.5208</span> <span style="#FF0000">12.974</span> <span style="#FF0000">3328.6494</span> <span style="#FF0000">11.0121</span> <span style="#FF0000">3334.3257</span> <span style="#FF0000">0.5727</span> <span style="#FF0000">3338.0091</span> <span style="#FF0000">19.8689</span> <span style="#FF0000">3340.0895</span> <span style="#FF0000">3.3902</span> <span style="#FF0000">3346.1489</span> <span style="#FF0000">9.9576</span> <span style="#FF0000">3349.8259</span> <span style="#FF0000">8.1264</span> <span style="#FF0000">3447.1727</span> <span style="#FF0000">128.4542</span> <span style="#FF0000">3456.8082</span> <span style="#FF0000">1.9686</span> <span style="#FF0000">3458.2356</span> <span style="#FF0000">5.0307</span> <span style="#FF0000">3465.5113</span> <span style="#FF0000">0.466</span> <span style="#FF0000">3468.7609</span> <span style="#FF0000">4.1457</span> <span style="#FF0000">3470.5013</span> <span style="#FF0000">2.5949</span> <span style="#FF0000">3718.79</span> <span style="#FF0000">592.2654</span> <span style="#FF0000">3737.2726</span> <span style="#FF0000">504.0469</span> <span style="#FF0000">3822.376</span> <span style="#FF0000">132.18</span> <span style="#FF0000">3841.1183</span> <span style="#FF0000">73.0049</span> <span style="#FF0000">3856.8681</span> <span style="#FF0000">52.7314</span> <span style="#FF0000">3863.233</span> <span style="#FF0000">65.2451</span> <span style="#FF0000">3871.7072</span> <span style="#FF0000">157.5003</span> <span style="#FF0000">3884.8637</span> <span style="#FF0000">42.4131</span> <span style="#FF0000">3887.9648</span> <span style="#FF0000">52.3414</span> <span style="#FF0000">EOD</span> <span style="color: #B8860B">data</span><span style="color: #666666">=</span><span style="color: #BB4444">"$ben"</span> <span style="color: #008800; font-style: italic"># 选择绘图数据</span> <span style="#FF0000">stat</span> <span style="#FF0000">data</span> <span style="#FF0000">u</span> <span style="#FF0000">1</span> <span style="#FF0000">nooutput</span> <span style="color: #008800; font-style: italic"># 统计峰的数目</span> <span style="color: #B8860B">Npnt</span><span style="color: #666666">=</span>STATS_records <span style="#FF0000">array</span> <span style="#FF0000">c[Npnt]</span><span style="color: #AA22FF; font-weight: bold">;</span> <span style="#FF0000">array</span> <span style="color: #AA22FF; font-weight: bold">h</span>[Npnt] <span style="color: #008800; font-style: italic"># 定义数组保存峰位置, 高度</span> <span style="#FF0000">stat</span> <span style="#FF0000">data</span> <span style="#FF0000">u</span> <span style="#FF0000">(c[$0+1]=$1,</span> <span style="#FF0000">1):(</span><span style="color: #AA22FF; font-weight: bold">h</span>[<span style="#FF0000">$</span><span style="color: #666666">0+1</span>]<span style="color: #666666">=</span><span style="#FF0000">$</span><span style="color: #666666">2,</span> <span style="color: #666666">2</span>) nooutput <span style="color: #008800; font-style: italic"># 填充数组</span> <span style="color: #008800; font-style: italic"># 定义展宽函数</span> <span style="color: #00A000">peak</span>(x,c,h,γG,γL)<span style="color: #666666">=</span>h<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>c<span style="color: #666666">,</span><span style="#FF0000">γ</span>G<span style="color: #666666">/</span><span style="color: #00A000">sqrt</span>(<span style="color: #00A000">log</span>(<span style="color: #666666">4</span>))<span style="color: #666666">,</span><span style="#FF0000">γ</span>L) <span style="color: #008800; font-style: italic"># 展宽参数</span> <span style="#FF0000">γ</span><span style="color: #B8860B">G</span><span style="color: #666666">=100</span> <span style="#FF0000">γ</span><span style="color: #B8860B">L</span><span style="color: #666666">=50</span> <span style="color: #008800; font-style: italic"># γV=VP_fwhm(γG/sqrt(log(4)),γL) # gnuplot 5.4尚不支持此函数</span> <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">xl</span> <span style="color: #BB4444">"cm^{-1}"</span> <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">yl</span> <span style="color: #BB4444">"a.u."</span> <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">tit</span> <span style="color: #00A000">sprintf</span>(<span style="color: #BB4444">"γ_G=%.1f γ_L=%.1f"</span><span style="color: #666666">,</span> <span style="#FF0000">γ</span>G<span style="color: #666666">,</span> <span style="#FF0000">γ</span>L) <span style="color: #008800; font-style: italic"># 绘制, 使用累加函数</span> <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">boxwidth</span> <span style="color: #666666">0.01</span> <span style="color: #008800; font-style: italic"># 使用柱状图画竖线, 5.5才支持Impulses</span> <span style="color: #AA22FF; font-weight: bold">p</span> [<span style="color: #666666">0:4000</span>] \ data <span style="color: #AA22FF">axis</span> x1y2 <span style="color: #AA22FF">w</span> boxes lw <span style="color: #666666">.5</span> <span style="color: #AA22FF">t</span> <span style="color: #BB4444">""</span><span style="color: #666666">,</span> \ sum [<span style="color: #AA22FF">i</span><span style="color: #666666">=1:</span>Npnt] <span style="color: #00A000">peak</span>(x<span style="color: #666666">,</span>c[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,</span>h[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,</span><span style="#FF0000">γ</span>G<span style="color: #666666">,0</span>) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Gauss"</span><span style="color: #666666">,</span> \ sum [<span style="color: #AA22FF">i</span><span style="color: #666666">=1:</span>Npnt] <span style="color: #00A000">peak</span>(x<span style="color: #666666">,</span>c[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,</span>h[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,0,</span><span style="#FF0000">γ</span>L) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Lorentz"</span><span style="color: #666666">,</span> \ sum [<span style="color: #AA22FF">i</span><span style="color: #666666">=1:</span>Npnt] <span style="color: #00A000">peak</span>(x<span style="color: #666666">,</span>c[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,</span>h[<span style="color: #AA22FF">i</span>]<span style="color: #666666">,</span><span style="#FF0000">γ</span>G<span style="color: #666666">,</span><span style="#FF0000">γ</span>L) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Voigt"</span></pre></div> </td></tr></table>另一个是某蛋白部分的红外光谱, 没有对称性, 所以有很多峰.
有了光谱展宽的经验, 处理光谱拟合也就没有太大问题了. 但光谱拟合的难点其实不在如何拟合, 而是在于分峰. 实验获得的光谱通常比较复杂, 在没有其他信息的条件下, 如何确定分峰的数目是一件很玄学的事情. 虽然也有一些数学上的处理方法, 但也不能作为最后的结论, 还是要结合实际经验和理论推测才成. 网上有很多拟合的示例, 但大都是基于赝Voig函数的:
下面示意一下如何使用gnuplot进行单峰拟合. 如果确定了分峰数目, 多峰拟合的过程大致类似.
<table class="highlighttable"><th colspan="2" style="text-align:left">vp-5.png</th><tr><td><div class="linenodiv" style="background-color: #f0f0f0; padding-right: 10px"><pre style="line-height:125%"> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176</pre></div></td><td class="code"><div class="highlight"><pre style="line-height:125%"><span></span><span style="#FF0000">$dat</span> <span style="#FF0000"><<EOD</span> <span style="#FF0000">0</span> <span style="#FF0000">3.3487290833206163</span> <span style="#FF0000">1</span> <span style="#FF0000">3.441076831745743</span> <span style="#FF0000">2</span> <span style="#FF0000">7.7932863251851305</span> <span style="#FF0000">3</span> <span style="#FF0000">7.519064207516034</span> <span style="#FF0000">4</span> <span style="#FF0000">7.394406511652473</span> <span style="#FF0000">5</span> <span style="#FF0000">11.251458210206666</span> <span style="#FF0000">6</span> <span style="#FF0000">4.679476113847004</span> <span style="#FF0000">7</span> <span style="#FF0000">8.313048016542345</span> <span style="#FF0000">8</span> <span style="#FF0000">9.348006472917458</span> <span style="#FF0000">9</span> <span style="#FF0000">6.086336477997078</span> <span style="#FF0000">10</span> <span style="#FF0000">10.765370342398741</span> <span style="#FF0000">11</span> <span style="#FF0000">11.402519337778239</span> <span style="#FF0000">12</span> <span style="#FF0000">11.151689287913552</span> <span style="#FF0000">13</span> <span style="#FF0000">8.546151698722557</span> <span style="#FF0000">14</span> <span style="#FF0000">8.323886291540909</span> <span style="#FF0000">15</span> <span style="#FF0000">7.133249200994414</span> <span style="#FF0000">16</span> <span style="#FF0000">10.242189407441712</span> <span style="#FF0000">17</span> <span style="#FF0000">8.887686444395982</span> <span style="#FF0000">18</span> <span style="#FF0000">10.759444780127321</span> <span style="#FF0000">19</span> <span style="#FF0000">9.21095463298772</span> <span style="#FF0000">20</span> <span style="#FF0000">15.693160143294264</span> <span style="#FF0000">21</span> <span style="#FF0000">9.239683298899614</span> <span style="#FF0000">22</span> <span style="#FF0000">9.476116297451632</span> <span style="#FF0000">23</span> <span style="#FF0000">10.128625585058783</span> <span style="#FF0000">24</span> <span style="#FF0000">10.94392508956097</span> <span style="#FF0000">25</span> <span style="#FF0000">10.274287987647595</span> <span style="#FF0000">26</span> <span style="#FF0000">9.552394167463973</span> <span style="#FF0000">27</span> <span style="#FF0000">9.51931115335406</span> <span style="#FF0000">28</span> <span style="#FF0000">9.923989117054466</span> <span style="#FF0000">29</span> <span style="#FF0000">8.646255122559495</span> <span style="#FF0000">30</span> <span style="#FF0000">12.207746464070603</span> <span style="#FF0000">31</span> <span style="#FF0000">15.249531807666745</span> <span style="#FF0000">32</span> <span style="#FF0000">9.820667193850705</span> <span style="#FF0000">33</span> <span style="#FF0000">11.913964012172858</span> <span style="#FF0000">34</span> <span style="#FF0000">9.506862412612637</span> <span style="#FF0000">35</span> <span style="#FF0000">15.858588835799232</span> <span style="#FF0000">36</span> <span style="#FF0000">14.918486963658015</span> <span style="#FF0000">37</span> <span style="#FF0000">15.089436171053094</span> <span style="#FF0000">38</span> <span style="#FF0000">14.38496801289269</span> <span style="#FF0000">39</span> <span style="#FF0000">14.42394419048644</span> <span style="#FF0000">40</span> <span style="#FF0000">15.759311758218061</span> <span style="#FF0000">41</span> <span style="#FF0000">17.063349232010786</span> <span style="#FF0000">42</span> <span style="#FF0000">12.232863723786215</span> <span style="#FF0000">43</span> <span style="#FF0000">10.988245956134314</span> <span style="#FF0000">44</span> <span style="#FF0000">19.109899560493286</span> <span style="#FF0000">45</span> <span style="#FF0000">18.344353100589824</span> <span style="#FF0000">46</span> <span style="#FF0000">17.397232553539542</span> <span style="#FF0000">47</span> <span style="#FF0000">12.372706600456558</span> <span style="#FF0000">48</span> <span style="#FF0000">13.038720878764792</span> <span style="#FF0000">49</span> <span style="#FF0000">19.100965014037367</span> <span style="#FF0000">50</span> <span style="#FF0000">17.094480819566147</span> <span style="#FF0000">51</span> <span style="#FF0000">20.801679461435484</span> <span style="#FF0000">52</span> <span style="#FF0000">15.763762333448557</span> <span style="#FF0000">53</span> <span style="#FF0000">22.302320507719728</span> <span style="#FF0000">54</span> <span style="#FF0000">23.394129891315963</span> <span style="#FF0000">55</span> <span style="#FF0000">19.884812694503303</span> <span style="#FF0000">56</span> <span style="#FF0000">22.09743700979689</span> <span style="#FF0000">57</span> <span style="#FF0000">16.995815335935077</span> <span style="#FF0000">58</span> <span style="#FF0000">24.286037929073284</span> <span style="#FF0000">59</span> <span style="#FF0000">25.214705826961016</span> <span style="#FF0000">60</span> <span style="#FF0000">25.305223543285013</span> <span style="#FF0000">61</span> <span style="#FF0000">22.656121668613896</span> <span style="#FF0000">62</span> <span style="#FF0000">30.185701748800568</span> <span style="#FF0000">63</span> <span style="#FF0000">28.28382587095781</span> <span style="#FF0000">64</span> <span style="#FF0000">35.63753811848088</span> <span style="#FF0000">65</span> <span style="#FF0000">35.59816270398698</span> <span style="#FF0000">66</span> <span style="#FF0000">35.64529822281625</span> <span style="#FF0000">67</span> <span style="#FF0000">36.213428394807224</span> <span style="#FF0000">68</span> <span style="#FF0000">39.56541841125095</span> <span style="#FF0000">69</span> <span style="#FF0000">46.360702383473075</span> <span style="#FF0000">70</span> <span style="#FF0000">55.84449512752349</span> <span style="#FF0000">71</span> <span style="#FF0000">64.50142387788203</span> <span style="#FF0000">72</span> <span style="#FF0000">77.75090937376423</span> <span style="#FF0000">73</span> <span style="#FF0000">83.00423387164669</span> <span style="#FF0000">74</span> <span style="#FF0000">111.98365374689226</span> <span style="#FF0000">75</span> <span style="#FF0000">121.05211901294848</span> <span style="#FF0000">76</span> <span style="#FF0000">176.82062069814936</span> <span style="#FF0000">77</span> <span style="#FF0000">198.46769832454626</span> <span style="#FF0000">78</span> <span style="#FF0000">210.52624393366017</span> <span style="#FF0000">79</span> <span style="#FF0000">215.36708238568033</span> <span style="#FF0000">80</span> <span style="#FF0000">221.58003148955638</span> <span style="#FF0000">81</span> <span style="#FF0000">209.7551225151964</span> <span style="#FF0000">82</span> <span style="#FF0000">198.4104196333782</span> <span style="#FF0000">83</span> <span style="#FF0000">168.13949002992925</span> <span style="#FF0000">84</span> <span style="#FF0000">126.0081896958841</span> <span style="#FF0000">85</span> <span style="#FF0000">110.39003569380478</span> <span style="#FF0000">86</span> <span style="#FF0000">90.88743461485616</span> <span style="#FF0000">87</span> <span style="#FF0000">60.5443025644061</span> <span style="#FF0000">88</span> <span style="#FF0000">71.00628698937221</span> <span style="#FF0000">89</span> <span style="#FF0000">61.616294708485384</span> <span style="#FF0000">90</span> <span style="#FF0000">45.32803695045095</span> <span style="#FF0000">91</span> <span style="#FF0000">43.85638472551629</span> <span style="#FF0000">92</span> <span style="#FF0000">48.863070901568086</span> <span style="#FF0000">93</span> <span style="#FF0000">44.65252243455522</span> <span style="#FF0000">94</span> <span style="#FF0000">41.209120125948104</span> <span style="#FF0000">95</span> <span style="#FF0000">36.63478075990383</span> <span style="#FF0000">96</span> <span style="#FF0000">36.098369542551325</span> <span style="#FF0000">97</span> <span style="#FF0000">37.75419965137265</span> <span style="#FF0000">98</span> <span style="#FF0000">41.102019290969956</span> <span style="#FF0000">99</span> <span style="#FF0000">26.874409332756752</span> <span style="#FF0000">100</span> <span style="#FF0000">24.63314900554918</span> <span style="#FF0000">101</span> <span style="#FF0000">26.05340465966265</span> <span style="#FF0000">102</span> <span style="#FF0000">26.787053802870535</span> <span style="#FF0000">103</span> <span style="#FF0000">16.51559065528567</span> <span style="#FF0000">104</span> <span style="#FF0000">19.367731289491633</span> <span style="#FF0000">105</span> <span style="#FF0000">17.794958746427422</span> <span style="#FF0000">106</span> <span style="#FF0000">19.52785218727518</span> <span style="#FF0000">107</span> <span style="#FF0000">15.437635249660396</span> <span style="#FF0000">108</span> <span style="#FF0000">21.96712662378481</span> <span style="#FF0000">109</span> <span style="#FF0000">15.311043443598177</span> <span style="#FF0000">110</span> <span style="#FF0000">16.49893493905559</span> <span style="#FF0000">111</span> <span style="#FF0000">16.41202114648668</span> <span style="#FF0000">112</span> <span style="#FF0000">17.904512123179114</span> <span style="#FF0000">113</span> <span style="#FF0000">14.198812322372405</span> <span style="#FF0000">114</span> <span style="#FF0000">15.296623848360126</span> <span style="#FF0000">115</span> <span style="#FF0000">14.39383356078112</span> <span style="#FF0000">116</span> <span style="#FF0000">10.807540004905345</span> <span style="#FF0000">117</span> <span style="#FF0000">17.405310725810278</span> <span style="#FF0000">118</span> <span style="#FF0000">15.309786310492559</span> <span style="#FF0000">119</span> <span style="#FF0000">15.117665282794073</span> <span style="#FF0000">120</span> <span style="#FF0000">15.926377010540376</span> <span style="#FF0000">121</span> <span style="#FF0000">14.000223621497955</span> <span style="#FF0000">122</span> <span style="#FF0000">15.827757539949431</span> <span style="#FF0000">123</span> <span style="#FF0000">19.22355433703294</span> <span style="#FF0000">124</span> <span style="#FF0000">12.278007446886507</span> <span style="#FF0000">125</span> <span style="#FF0000">14.822245428954957</span> <span style="#FF0000">126</span> <span style="#FF0000">13.226674931853903</span> <span style="#FF0000">127</span> <span style="#FF0000">10.551237809932955</span> <span style="#FF0000">128</span> <span style="#FF0000">8.58081654372226</span> <span style="#FF0000">129</span> <span style="#FF0000">10.329123069771072</span> <span style="#FF0000">130</span> <span style="#FF0000">13.709943935412294</span> <span style="#FF0000">131</span> <span style="#FF0000">11.778442391614956</span> <span style="#FF0000">132</span> <span style="#FF0000">14.454930746849122</span> <span style="#FF0000">133</span> <span style="#FF0000">10.023352452542506</span> <span style="#FF0000">134</span> <span style="#FF0000">11.01463585064886</span> <span style="#FF0000">135</span> <span style="#FF0000">10.621062477382623</span> <span style="#FF0000">136</span> <span style="#FF0000">9.29665510291416</span> <span style="#FF0000">137</span> <span style="#FF0000">9.633579419680572</span> <span style="#FF0000">138</span> <span style="#FF0000">11.482703531988037</span> <span style="#FF0000">139</span> <span style="#FF0000">9.819073927883121</span> <span style="#FF0000">140</span> <span style="#FF0000">12.095918617534196</span> <span style="#FF0000">141</span> <span style="#FF0000">9.820590920621864</span> <span style="#FF0000">142</span> <span style="#FF0000">9.620109753045565</span> <span style="#FF0000">143</span> <span style="#FF0000">13.215701804432598</span> <span style="#FF0000">144</span> <span style="#FF0000">8.092085538619543</span> <span style="#FF0000">145</span> <span style="#FF0000">9.828015669152578</span> <span style="#FF0000">146</span> <span style="#FF0000">8.259655585415379</span> <span style="#FF0000">147</span> <span style="#FF0000">9.424189583067022</span> <span style="#FF0000">148</span> <span style="#FF0000">13.149985946123934</span> <span style="#FF0000">149</span> <span style="#FF0000">7.471175119197948</span> <span style="#FF0000">150</span> <span style="#FF0000">10.947567075630904</span> <span style="#FF0000">151</span> <span style="#FF0000">10.777888096711512</span> <span style="#FF0000">152</span> <span style="#FF0000">8.477442195191612</span> <span style="#FF0000">153</span> <span style="#FF0000">9.585429992609711</span> <span style="#FF0000">154</span> <span style="#FF0000">7.032549866566089</span> <span style="#FF0000">155</span> <span style="#FF0000">5.103962051624133</span> <span style="#FF0000">156</span> <span style="#FF0000">9.285999577275545</span> <span style="#FF0000">157</span> <span style="#FF0000">7.421574444036404</span> <span style="#FF0000">158</span> <span style="#FF0000">5.740841317806245</span> <span style="#FF0000">159</span> <span style="#FF0000">2.3672530845679</span> <span style="#FF0000">EOD</span> <span style="color: #B8860B">Ag</span><span style="color: #666666">=100</span>; <span style="color: #B8860B">cg</span><span style="color: #666666">=80</span>; <span style="color: #B8860B">sg</span><span style="color: #666666">=6</span>; <span style="color: #B8860B">Al</span><span style="color: #666666">=100</span>; <span style="color: #AA22FF; font-weight: bold">cl</span><span style="color: #666666">=80</span>; <span style="color: #B8860B">gl</span><span style="color: #666666">=6</span>; <span style="color: #B8860B">A</span><span style="color: #666666">=100</span>; <span style="color: #B8860B">c</span><span style="color: #666666">=80</span>; <span style="color: #B8860B">s</span><span style="color: #666666">=6</span>; <span style="color: #B8860B">g</span><span style="color: #666666">=6</span>; <span style="color: #AA22FF; font-weight: bold">fit</span> Ag<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>cg<span style="color: #666666">,</span> sg<span style="color: #666666">,</span> <span style="color: #666666">0</span>) <span style="#FF0000">$</span>dat <span style="color: #AA22FF">u</span> <span style="color: #666666">1:2</span> <span style="color: #AA22FF">via</span> Ag<span style="color: #666666">,</span> cg<span style="color: #666666">,</span> sg <span style="color: #AA22FF; font-weight: bold">fit</span> Al<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>cl<span style="color: #666666">,</span> <span style="color: #666666">0,</span> gl) <span style="#FF0000">$</span>dat <span style="color: #AA22FF">u</span> <span style="color: #666666">1:2</span> <span style="color: #AA22FF">via</span> Al<span style="color: #666666">,</span> cl<span style="color: #666666">,</span> gl <span style="color: #AA22FF; font-weight: bold">fit</span> A<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>c<span style="color: #666666">,</span> <span style="color: #AA22FF">s</span><span style="color: #666666">,</span> g) <span style="#FF0000">$</span>dat <span style="color: #AA22FF">u</span> <span style="color: #666666">1:2</span> <span style="color: #AA22FF">via</span> A<span style="color: #666666">,</span> c<span style="color: #666666">,</span> <span style="color: #AA22FF">s</span><span style="color: #666666">,</span> g <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">xl</span><span style="color: #BB4444">"x"</span> <span style="color: #AA22FF; font-weight: bold">set</span> <span style="color: #AA22FF">yl</span><span style="color: #BB4444">"y"</span> <span style="color: #AA22FF; font-weight: bold">p</span> <span style="#FF0000">$</span>dat <span style="color: #AA22FF">w</span> p <span style="color: #AA22FF">t</span><span style="color: #BB4444">"data"</span><span style="color: #666666">,</span> \ Ag<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>cg<span style="color: #666666">,</span> sg<span style="color: #666666">,</span> <span style="color: #666666">0</span>) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Gauss"</span><span style="color: #666666">,</span> \ Al<span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>cl<span style="color: #666666">,</span> <span style="color: #666666">0,</span> gl) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Lorentz"</span><span style="color: #666666">,</span> \ A <span style="color: #666666">*</span><span style="color: #00A000">VP</span>(x<span style="color: #666666">-</span>c<span style="color: #666666">,</span> <span style="color: #AA22FF">s</span><span style="color: #666666">,</span> g) <span style="color: #AA22FF">t</span> <span style="color: #BB4444">"Voigt"</span></pre></div> </td></tr></table>可以看到, 洛伦兹函数和Voigt函数的拟合结果区别不大, 这说明测试数据更接近洛伦兹函数.