%% Visualize and Plot Solutions Returned by solve
%% Initial setting up
%% 1

syms x
[solx, param, cond] = solve(cos(x) == -sin(x), x, 'ReturnConditions', true)

%
%% 2

assume(cond)
solk = solve(solx<2*pi, solx>-2*pi, param)

%
%% 3

xvalues = subs(solx, solk)

%
%% 4

xvalues = vpa(xvalues)

%
%% 5

fplot(cos(x))
hold on
grid on
fplot(-sin(x))
title('Both sides of equation cos(x) = -sin(x)')
legend('cos(x)','-sin(x)','Location','best','AutoUpdate','off')

%
%% 6

yvalues = cos(xvalues)
scatter(xvalues, yvalues)

% Copyright 2012 The MathWorks, Inc.