求助一个函数拟合算法的实现方法

2019-12-22 13:50发布

想做一款温控器,用于自己的小回流焊(九阳电烤箱改的),用的是论坛里的电路,ADC用的是TM7707,只用了其中的高16位数据,以下是实际的温度与ADC读数对比,求助用哪种方式将ADC的数据处理成需要显示的温度?
实际温度    ADC数据(将读到的数据*0.1后的结果)
25     435
35     462
40     476
45     489
50     502
90     607
105   648
120   690
125   702
150   763
170   810
190   853
200   874
210   897
220   917
230   936
240   964
260  992
265  1008
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
11条回答
chencc8
2019-12-23 07:58
根据情况可以选择分段拟合或者多项式拟合,使用多项式拟合的话,结果如下:
a0 = -88.616
a1 = 0.199288
a2 = 0.000149994
x0 = 435  counter y = 26.4568  true y = 25  error = 5.82737%
x1 = 462  counter y = 35.4703  true y = 35  error = 1.34375%
x2 = 476  counter y = 40.2301  true y = 40  error = 0.575153%
x3 = 489  counter y = 44.7025  true y = 45  error = -0.661166%
x4 = 502  counter y = 49.2256  true y = 50  error = -1.54883%
x5 = 607  counter y = 87.6168  true y = 90  error = -2.64796%
x6 = 648  counter y = 103.506  true y = 105  error = -1.42327%
x7 = 690  counter y = 120.305  true y = 120  error = 0.253921%
x8 = 702  counter y = 125.202  true y = 125  error = 0.161324%
x9 = 763  counter y = 150.762  true y = 150  error = 0.50827%
x10 = 810  counter y = 171.218  true y = 170  error = 0.716542%
x11 = 853  counter y = 190.513  true y = 190  error = 0.270211%
x12 = 874  counter y = 200.138  true y = 200  error = 0.0691344%
x13 = 897  counter y = 210.832  true y = 210  error = 0.395992%
x14 = 917  counter y = 220.259  true y = 220  error = 0.117779%
x15 = 936  counter y = 229.326  true y = 230  error = -0.292864%
x16 = 964  counter y = 242.886  true y = 240  error = 1.20256%
x17 = 992  counter y = 256.681  true y = 260  error = -1.27652%
x18 = 1008  counter y = 264.669  true y = 265  error = -0.124732%

  total error = 1.6584

看来你的情况使用分段(线性或者曲线)拟合会更合适。

一周热门 更多>