%% Return One Solution
% Solve the equation sin(x) + cos(2x) = 1.
% Instead of returning an infinite set of periodic solutions, the solver picks three solutions that it considers to be the most practical.

syms x
eqn = sin(x) + cos(2*x) == 1;
S = solve(eqn,x)

% Choose only one solution by setting 'PrincipalValue' to true.

S1 = solve(eqn,x,'PrincipalValue',true)

%
% Copyright 2006-2019 The MathWorks, Inc.