# Using solve to solve a complex trigonometric equation

2 views (last 30 days)
Junha Kim on 28 Apr 2020
Commented: Junha Kim on 28 Apr 2020
i want to solve the trigonometric equation, but actual answers and the answers matlab gives me are different,,, please help me to get correct answers,,
here's my code
syms x;
assume(x>=0 & x<=2*pi);
f(x) = cos(x) * (1 - sin(x));
Y = solve( f(x) == 0);
Y
Y =
pi/2
actually, there should be one more.. 1.5pi,,, please help me :(
##### 1 CommentShow -1 older commentsHide -1 older comments
Peter Toth on 28 Apr 2020

Sign in to comment.

### Accepted Answer

Mrutyunjaya Hiremath on 28 Apr 2020
Hello Junha Kim,
syms x;
assume(x>=0 & x<=2*pi);
eqn = cos(x)*(1-sin(x)) == 0;
[solx, parameters, conditions] = solve(eqn, x, 'ReturnConditions',true);
assume(conditions);
restrictions = [x>=0, x<=2*pi];
solk = solve(restrictions, parameters);
valx = subs(solx, solk)
for more information, refer here
##### 1 CommentShow -1 older commentsHide -1 older comments
Junha Kim on 28 Apr 2020
I really appreciate for your help. Thank You.

Sign in to comment.

### Categories

Find more on Solver Outputs and Iterative Display 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!