zoukankan      html  css  js  c++  java
  • NTC温度采集之数据拟合——freemat软件实现

    在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,以此类推

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

  • 相关阅读:
    mysql_pw 指令 数据库创建过程
    node.js+mysql环境搭建
    MySQL 学习
    express 应用创建及app.js详解
    .NET MD5加密解密代码
    Axure 部件的交互样式
    easyUI -messager -消息框
    Window01
    linkbutton
    easyUi-datagrid 真分页 + 工具栏添加控件
  • 原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/10228468.html
Copyright © 2011-2022 走看看