MATLAB: Using solve to solve a complex trigonometric equation

solvetrigonometric

i have trouble solving the trigonometric equations, and i really don't know what the problem is. Please look at my code and point out if i were wrong or not. Thank You
(I'm using 2019b version)
>> syms x
>> assume(0 <= x <= 2*pi)
>> solve (sin(x)*cos(x) == 0) %%%What's wrong with this result,,,, i really can't get it
ans =
0
>> solve (sin(2*x) == 0)
ans =
0
pi
2*pi
pi/2
(3*pi)/2

Best Answer

The solve function works best with simplified expressions, since it does not simplify them by default:
syms x
assume(0 <= x <= 2*pi)
Eq = sin(x)*cos(x);
Eq = simplify(Eq, 'Steps',500);
solve (Eq == 0)
produces:
ans =
0
pi
2*pi
pi/2
(3*pi)/2
.
Related Question