Multiple Answers From 'solve'
이전 댓글 표시
I have an equation that I am passing to the 'solve' function. I know for a fact that it has two solutions. It only returns one solution. This is how I'm calling solve:
solve(S)
where S is a string containing the equation. It's pretty ugly but I can provide it if needed. What I need is a way to get that second solution.
댓글 수: 5
Andrew Newell
2012년 1월 9일
Yes, we will need to see that string - formatted nicely, please.
Zachary
2012년 1월 9일
Zachary
2012년 1월 9일
Andrew Newell
2012년 1월 9일
Are you trying to solve symbolically for theta4?
Zachary
2012년 1월 9일
채택된 답변
추가 답변 (1개)
Walter Roberson
2012년 1월 9일
Take your original equation,
24.073^2 = (-4.19*sin((1/180)*theta2*Pi) - 5.166*sin((1/180)*theta4*Pi) + 23.3*sin(.4610555556*Pi))^2 + (-4.19*cos((1/180)*theta2*Pi) - 5.166*cos((1/180)*theta4*Pi) + 23.3*cos(.4610555556*Pi))^2
and do trig substitutions on it.
24.073^2 = 587.1336560 + 43.29108000*cos((1/180)*theta2*Pi - (1/180)*theta4*Pi) - 195.2540000*cos((1/180)*theta2*Pi-.4610555556*Pi) - 240.7356000*cos((1/180)*theta4*Pi-.4610555556*Pi)
Substitute in any one value for theta2 and the equation becomes one involving constants, and cos() of theta4 converted from degrees to radians. It then becomes obvious that the solution must be periodic over 360 (degrees) and the positive-going and negative-going solutions must be 180 apart.
Thus, all you need from solve() is a single solution, which you can then normalize according to your preferred range, with the other solution in that preferred range 180 apart.
댓글 수: 3
Zachary
2012년 1월 9일
Walter Roberson
2012년 1월 9일
Use vpa() or double() on the expression
Note: above I used Pi with capital-P . In MATLAB you would use pi with lower-case-p .
Zachary
2012년 1월 10일
카테고리
도움말 센터 및 File Exchange에서 Common Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!