I tried this code in MATLAB in order to plot the piecewise function:
f(x) = cos (x) for x < 0 and e^-x (1 - x^2) for x >= 0: p y=piecewise(x)
plot(x,y)
xlabel('x')
ylabel('y')
title('Plots of $y = \cos x$ and $e^(-x)(1 - x^2)$', 'interpreter', 'latex')
I can't seem to find much information online in regards to plotting these quite simplistic Piecewise functions in MATLAB.
Install the symbolic math toolbox and then this should work: