5

I want to make a plot with different value of the same parameter (say I have five values) and all on the same plot. How can this be done in gnuplot 4.4? For example consider plotting f(x)= 1/(1+exp(x/a)).

Christoph
  • 47,569
  • 8
  • 87
  • 187
Ab Gaurav
  • 51
  • 1
  • 2

1 Answers1

8

To have several plots in one graph use:

f(x,a) = 1/(1+exp(x/a))
plot f(x,1), f(x,2)

For a more automated plot command, use for iteration:

plot for [a=1:5:2] 1/(1+exp(x/a)) title sprintf("a = %d", a)

That gives (with version 4.4.4):

enter image description here

Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Thank you! That was exactly what I was looking for. Earlier I was using different names for the function and the parameter and was plotting as following: f(x)=1/(1+exp(x/a1)); g(x)=1/(1+exp(x/a2)); a1=2;a2=5; plot f(x),g(x) But its a lot of work for a large range of parameters. – Ab Gaurav Mar 18 '14 at 16:54