y=(sinx)^2-2cosx+1
=1-cos^2x-2cosx+1
=3-(cos^2x+2cosx+1)
=3-(cosx+1)^2
cosx=-1时,有最大值3
cosx=1时,有最小值-1
因此值域[-1,3]