博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
NTC温度采集之数据拟合——freemat软件实现
阅读量:4350 次
发布时间:2019-06-07

本文共 769 字,大约阅读时间需要 2 分钟。

在stm32温度采样的过程中,使用到了NTC传感器,上拉接6.2K的电阻,信号给AD采样端口,通过NTC的电阻阻值表中,计算得到下面两端数据,在freemat中实现数据拟合,用于程序中温度和电压信号的转换。

x = [1173.32

1203.94
1234.89
1266.77
1298.86
1331.75
1365.33
1399.55
1434.31
1469.54
1505.45
1541.66
1578.63
1616.24
1654.15
];
y=[60.000
59.000
58.000
57.000
56.000
55.000
54.000
53.000
52.000
51.000
50.000
49.000
48.000
47.000
46.000
];
figure
subplot(2, 1, 1)
p = polyfit(x,y,2);
ti=1173:10:1690;
yi=polyval(p,ti);
plot(x,y,'o',ti,yi,'*');
grid on
p
subplot(2, 1, 2)
p = polyfit(x,y,1);
ti=1173:10:1690;
yi=polyval(p,ti);
plot(x,y,'o',ti,yi,'*');
grid on
p

 

p是多项式的系数

--> p

-->
ans =
0.0000 -0.0493 107.9274
-->
ans =
-0.0291 93.8403

可以得到y=-0.0291x+ 93.8403,以此类推

 

拟合的图形如下:基本上,一次函数就可以完成数据拟合了,温度采集的精度也可以接受的

转载于:https://www.cnblogs.com/CodeWorkerLiMing/p/10228468.html

你可能感兴趣的文章
PHP学习2
查看>>
一个不错的计时器类
查看>>
多实例Mysql配置
查看>>
CentOS6.5桌面版安装VirtualBox提示错误/etc/init.d/vboxdrv setup
查看>>
KOA中间件源码解析
查看>>
构建之法阅读笔记03
查看>>
jquery 点击切换值
查看>>
vue+element前端自行分页
查看>>
C#操作XML
查看>>
tkinter学习02
查看>>
Mapnik使用postgres中的栅格数据
查看>>
html基本知识
查看>>
IOS手势不识别
查看>>
IOS网络编程之请求内容
查看>>
爬虫——为什么有代理
查看>>
HDU 1599 find the mincost route(floyd求最小环 无向图)
查看>>
vue v-for循环checkbox存在的问题
查看>>
hibernate模糊查询-Restrictions.ilike & Expression.like
查看>>
二分·归并排序之逆序对 算法讲解和题目
查看>>
python @property
查看>>