May*_*ank 0 algorithm numbers arduino calculator
我想计算一个控制器内的方程式(Arduino)
y = -0.0000000104529251928664x ^ 3 + 0.0000928316793270531x ^ 2 - 0.282333029643959x + 297.661280719026
现在系数的十进制值很重要,因为"x"的变化数以千计,因此不能忽略立方体项.我曾尝试在excel中操作方程式以减少系数,但R ^ 2在此过程中丢失,我想避免这种情况.
Arduino中可用的最大可变大小为4byte.在谷歌搜索,我无法找到合适的解决方案.
感谢您的时间.
以来
-0.0000000104529251928664 ^ (1/3) = - 0.0021864822
0.0000928316793270531 ^ (1/2) = 0.00963491978
Run Code Online (Sandbox Code Playgroud)
公式
y = -0.0000000104529251928664x^3 + 0.0000928316793270531x^2 - 0.282333029643959x + 297.661280719026
Run Code Online (Sandbox Code Playgroud)
可以改写:
y = -(0.0021864822 * x)^3 + (0.00963491978 * x)^2 - 0.282333029643959 * x + 297.661280719026
Run Code Online (Sandbox Code Playgroud)
将所有系数舍入到10位小数,我们得到:
y = -(0.0021864822 * x)^3 + (0.00963491978 * x)^2 - 0.2823330296 * x + 297.6612807
Run Code Online (Sandbox Code Playgroud)
但我不知道Arduino,我不确定正确的小数位数是多少,也不知道编译器接受或拒绝的是什么.