Help when trying to make an exponential graph

Hello i am very new to matlab and figuring out how to input an exponential equation. So this is the equation I am trying to plot:
y=110000(e^(-0.04x))
and this is what i input to matlab command.
x=[0,Inf]
y=110000*exp(-0.04*x);
plot (x,y)
i keep changing and responding to the errors but it keeps making a blank plot

Answers (1)

MATLAB interprets a coordinate of infinity as an indication that the corresponding point and the lines connecting to it should not be plotted. With your x of [0, inf] you only have two points, and the second is not going to be plotted because it is inf. That leaves only one point to plot, but when you attempt to plot only a single point, unless you have specified a marker, nothing is going to show up, because by default plot() only plots connecting lines.
Note that when you use x=[0,Inf] you are only asking for exactly two points, 0 and inf . If the point at inf could be plotted, then you would end up with a straight line, since you would have only two endpoints.
You should look at linspace(). And you will have to abandon the idea of plotting to infinity, as your screen is not infinitely wide.

Asked:

on 9 Feb 2018

Answered:

on 9 Feb 2018

Community Treasure Hunt

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

Start Hunting!