有人可以为我简化这个等式吗? [英] Can sombody simplify this equation for me?

查看:32
本文介绍了有人可以为我简化这个等式吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用 Mathematica,但遗憾的是我没有.我只想找到 A,B,C,D形成矩阵

I know I can use Mathematica, but sadly I dont have one. I just want to find the A,B,C,D form matrix

| X1^3 x1^2 X1 1 |   |A|   |y0|
| X2^3 x2^2 X2 1 |   |B|   |y1|
| X3^3 x3^2 X3 1 | X |C| = |y2|
| X4^3 x4^2 X4 1 |   |D|   |y3|

我只想找到 A、B、C 和 D 的简化方程.

I just want to find the simplified equations for A, B, C and D.

实际上我正在尝试在 arduino 中做一个需要使用 4 个点进行曲线拟合的程序,以便我可以预测未来的点.我看过这篇文章,但抛物线不足以满足我的需要.

Actually I am trying to do a program in arduino that requires curve fitting using 4 points, so that I can predict the future points. I have seen this post , but parabola isn't accurate enough for my need.

我已经尝试过 http://www.wolframalpha.com/.

linearSolve [{{(x1)^3, (x1)^2, x1, 1},
              {(x2)^3, (x2)^2, x2, 1},
              {(x3)^3, (x3)^2, x3, 1},
              {(x4)^3, (x4)^2, x4, 1}}, {{y1},{y2},{y3},{y4}}]

返回一个长结果,可以简化.但是,我无法在搜索栏中输入完整结果以进行简化(它给了我错误:输入太长!).

It returns a long result, which can be simplified. But, I cannot enter the full result in the search bar for simplifying (It gives me the error :Input Too Long!).

有什么想法吗?好吧,我想这在桌面版本中是可能的.

Any Ideas? Well I guess it would be possible in desktop versions.

即使在那之后,如果结果很长,请代入 x1 = 0 并让我知道简化的结果.

Even after that, if the result is quite long, please substitute x1 = 0 and let me know the simplified result.

推荐答案

// Input data: arrays x[] and y[]
// x[1],x[2],x[3],x[4] - X values
// y[1],y[2],y[3],y[4] - Y values

// Calculations
A = 0
B = 0
C = 0
D = 0
S1 = x[1] + x[2] + x[3] + x[4]
S2 = x[1]*x[2] + x[1]*x[3] + x[1]*x[4] + x[2]*x[3] + x[2]*x[4] + x[3]*x[4]
S3 = x[1]*x[2]*x[3] + x[1]*x[2]*x[4] + x[1]*x[3]*x[4] + x[2]*x[3]*x[4]
for i = 1 to 4 loop
   C0 = y[i]/(((4*x[i]-3*S1)*x[i]+2*S2)*x[i]-S3)
   C1 = C0*(S1 - x[i])
   C2 = S2*C0 - C1*x[i]
   C3 = S3*C0 - C2*x[i]
   A = A + C0
   B = B - C1
   C = C + C2
   D = D - C3
end-loop

// Result: A, B, C, D

这篇关于有人可以为我简化这个等式吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆