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!

 採用された回答

Wayne King
Wayne King 2013 年 11 月 27 日

0 投票

For a unit vector, cos(\theta) is just the x-coordinate and sin(\theta) is the y coordinate, so look at the help for atan2().
Plug the appropriate values (and appropriate signs) in and you have the angle in radians.

1 件のコメント

dave357
dave357 2013 年 11 月 27 日
Thank you! I didn't realise it would be so simple

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

その他の回答 (2 件)

Walter Roberson
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
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 ExchangeProgramming についてさらに検索

質問済み:

2013 年 11 月 27 日

コメント済み:

2013 年 11 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by