f=@(x)x.*sin(x)-1/2;
x=fsolve(f,[-10:1:10])
x =
Columns 1 through 6
-9.3714 -9.3714 -6.3619 -6.3619 -2.9726 -2.9726
Columns 7 through 12
-0.7408 0.7408 2.9726 2.9726 2.9726 6.3619
Columns 13 through 15
6.3619 9.3714 9.3714
剔除重复的值 有八个解
-9.3714 -6.3619 -2.9726 -0.7408 0.7408 2.9726 6.3619 9.3714