MATLAB Answers

plotting a function correctly

13 views (last 30 days)
Justin
Justin on 27 Oct 2020
Commented: Justin on 27 Oct 2020
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)

  0 Comments

Sign in to comment.

Accepted Answer

Sindar
Sindar on 27 Oct 2020
x=[-2:0.1:2];
y = exp(-x)-x;
plot(x,y)

  1 Comment

Justin
Justin on 27 Oct 2020
Thank you. lol

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!