MATLAB: Plotting a function correctly

plotting

f(x)= exp(-x)-x
The x intercept is between 0 and 1 on other graphing software, yet mat lab incorrectly puts the x intercept after 2. Please correct my code.
x=[-2:0.1:2];
y = exp(-x)-x;
plot(x,y)

Best Answer

x=[-2:0.1:2];
y = exp(-x)-x;
plot(x,y)
Related Question