I want to plot following function in Mathematica:
$f(x) = \frac{x}{x+c}$
I used the following command.
ListPlot[x/(x+c), {c, 1,10}, {x, 0, 10, 0.1}]
But it does not give me legends like which plot belongs to which value of c. Need help ASAP.
I want to plot following function in Mathematica:
$f(x) = \frac{x}{x+c}$
I used the following command.
ListPlot[x/(x+c), {c, 1,10}, {x, 0, 10, 0.1}]
But it does not give me legends like which plot belongs to which value of c. Need help ASAP.
You should really use Plot
Plot[Evaluate@Table[x/(x+c),{c,1,10}],{x,0,10},PlotLegends->"Expressions"]
evaluates to:
Explanation:
1.
Table[x/(x+c),{c,1,10}]
Evaluates to your functions, for the given Range of c.
{x/(1+x),x/(2+x),x/(3+x),x/(4+x),x/(5+x),x/(6+x),x/(7+x),x/(8+x),x/(9+x),x/(10+x)}
2.
Evaluate@Table[...
Evaluate forces Mathematica to evaluate the Table-expression. This must be done, because Plot holds its arguments. See here.
3.
PlotLegends->"Expressions"
Is an option for Plot and says Mathematica, that it should use the function-expressions as PlotLegends.
Plot3D[x/(x+c),{c,1,10},{x,0,10}]or if you want to plot your function multiple times for differentc, usePlot[Evaluate@Table[x/(x+c),{c,1,10}],{x,0,10}]– Julien Kluge Apr 23 '17 at 10:26