Matlab problem, not sure how to solve a certain simultaneous equation?
古いコメントを表示
Hey, I've been given Sin theta = 0.5 and cos theta = -0.8660 and I need to solve them both simultaneously to find a value for theta which satisfies both equations. I've figured out I need to use either atan or atan2, but I'm not sure how to use when its not straight forward cartesian coordiantes. Does anyone have any ideas? Any help would be much appreciated!
採用された回答
その他の回答 (2 件)
Walter Roberson
2013 年 11 月 27 日
0 投票
If you use the sine and cosine identities, you have at most four places to check. Examine the behavior of sin(theta +/- Pi) and sin(theta +/- Pi/2) and likewise for cos. With an asin() and acos() you can identify the basic angle and then you just need to use the identities to choose the quadrants.
Alternately, you could keep going along the lines you were thinking, using r = 1 to transform to cartesian coordinates.
Roger Stafford
2013 年 11 月 27 日
0 投票
Using atan2 will give you 5/6*pi radians as an answer. However, you should understand that there are infinitely more possible answers, each of them obtained by adding or subtracting multiples of 2*pi from this value.
カテゴリ
ヘルプ センター および File Exchange で Programming についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!