Plot[Piecewise[{{cos(x), 0<=x<=1}, {x^2, x<0 or x > 1}}], {x, -1, 2}]