MATLAB: How to find the 3 roots of the equation 2sinx=x

solvevpasolve

I entered as following: syms x vpasolve(2*sin(x)==x, x)
Matlab gives one answer only ans=0. But the correct answer should have 3 solutions. x=-1.89549, or x=0, or x=1.89549
Please help. Thanks

Best Answer

syms x
fplot(2*sin(x)-x)
grid on
vpasolve(2*sin(x)==x,x,2)
vpasolve(2*sin(x)==x,x,-2)
vpasolve(2*sin(x)==x,x)
Remark: See the graph guess the nearest root and get the exact root results