Array indexing multiple equations
1 次查看(过去 30 天)
显示 更早的评论
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?
采纳的回答
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Particle & Nuclear Physics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!