Matlab problem, not sure how to solve a certain simultaneous equation?

1 view (last 30 days)
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!

Accepted Answer

Wayne King
Wayne King on 27 Nov 2013
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.

More Answers (2)

Walter Roberson
Walter Roberson on 27 Nov 2013
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 on 27 Nov 2013
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.

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!