Maybe I'm not understanding the logistics of ezplot and fplot, but I just need to plot the function f(x) = x-2*exp(-x). When I use either function, the plot is incorrect.
syms xfx1 = ezplot(x-2*exp(-x))fx2 = fplot(x-2*exp(-x))
Additionally, I tried creating a loop to generate y values and plot them against x but that is also not working as the y values are incorrect. This is the loop I've tried:
clear all close allx = 1:1000;for i = 1:1000 fx(i) = i - 2*exp(-i);endplot(x,fx)
This seems like such an easy task so I'm not certain why I'm having so much trouble. I assume it's something small I'm overlooking.
Best Answer