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!

 Akzeptierte Antwort

Wayne King
Wayne King am 27 Nov. 2013

0 Stimmen

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.

Weitere Antworten (2)

Walter Roberson
Walter Roberson am 27 Nov. 2013

0 Stimmen

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 am 27 Nov. 2013

0 Stimmen

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.

Kategorien

Mehr zu Programming finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 27 Nov. 2013

Kommentiert:

am 27 Nov. 2013

Community Treasure Hunt

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

Start Hunting!

Translated by