Array indexing multiple equations

9 ビュー (過去 30 日間)
Ezgi
Ezgi 2014 年 4 月 1 日
コメント済み: Ezgi 2014 年 4 月 2 日
x1(i+1)=x1(i)+x2(i);
x3(i+1)=x3(i)+x4(i);
x5(i+1)=x5(i)+x6(i);
x2(i+1)=x2(i)+cos(x3(i))*x4(i+1)-x6(i+1);
x4(i+1)=x4(i);
x6(i+1)=x6(i)+cos(x5(i))*x2(i+1);
I came up with 6 equations for 6 variables. I have the equations above. x2(i+1) depends on x4(i+1) but that value is not calculated until x2(i+1) is calculated. How do I solve this problem do I need more equations?
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 4 月 1 日
This is not a differential equation

サインインしてコメントする。

採用された回答

Andrew Sykes
Andrew Sykes 2014 年 4 月 1 日
You need to do some algebra on these equations before you solve them.
The variable x4 is a constant (x4(i+1) = x4(i) tells us this), so replace x4(i+1) -> x4(i) in the equation for x2(i+1) to give:
x2(i+1)=x2(i)+cos(x3(i))*x4(i)-x6(i+1); (*)
Now substitute x6(i+1)=x6(i)+cos(x5(i))*x2(i+1) into this equation (*) and solve for x2(i+1). This will give:
x2(i+1)=( x2(i)+cos(x3(i))*x4(i)-x6(i) )/( 1+cos(x5(i)) );
Finally, substitute x2(i+1)=( x2(i)+cos(x3(i))*x4(i)-x6(i) )/( 1+cos(x5(i)) ) into the equation for x6(i+1) to give
x6(i+1)=x6(i)+cos(x5(i))*( x2(i)+cos(x3(i))*x4(i)-x6(i) )/( 1+cos(x5(i)) );
Now you should be okay to solve this problem within a for-loop provided you have a known initial condition.
  1 件のコメント
Ezgi
Ezgi 2014 年 4 月 2 日
Thank you for your answer. That really helped. If the system were like this;
x1(i+1)=x1(i)+x2(i); x3(i+1)=x3(i)+x4(i); x5(i+1)=x5(i)+x6(i);
x2(i+1)=x2(i)-1/(m0+m1+m2)*((1/2*m1*l1+m2*l1)*cos(x3(i))*x4(i+1)-(1/2*m2*l2*cos(x5(i)))*x6(i+1)-sigma0*x2(i)+(1/2*m1*l1+m2*l1)*x4(i)*sin(x3(i))*x4(i)-1/2*m2*l2*cos(x5(i))*x6(i)-F);
x4(i+1)=x4(i)-1/(J1+m2*l1^2)*((1/2*m1*l1+m2*l1)*cos(x3(i))*x2(i+1)-(1/2*m2*l1*l2*cos(x3(i)-x5(i)))*x6(i+1)-1/2*m1*l1*cos(x3(i))*x2(i)-(sigma1+sigma2)*x4(i)-(-sigma2-1/2*m2*l1*l2*x6(i)*sin(x3(i)-x5(i)))*x6(i)+(1/2*m1+m2)*g*l1*sin(x3(i)));
x6(i+1)=x6(i)-1/J2*(1/2*m2*l2*cos(x5(i))*x2(i+1)-1/2*m2*l1*l2*cos(x3(i)-x5(i))*x4(i+1)-1/2*m2*l2*cos(x5(i))*x2(i)-(-sigma2-1/2*m2*l1*l2*x6(i)*sin(x3(i)-x5(i)))*x4(i)-sigma2*x6(i)-1/2*m2*g*l2*sin(x5(i)));
Here, x2(i+1) depends on x4(i+1) and x6(i+1), x4(i+1) depends on x2(i+1) and x6(i+1), x6(i+1) depends on x2(i+1) and x4(i+1).How can I solve for x in this case?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by