Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I plot a function with different values of a parameter on the same plot in gnuplot 4.4?

Tags:

gnuplot

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)).

like image 536
Ab Gaurav Avatar asked Mar 15 '14 10:03

Ab Gaurav


1 Answers

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

like image 180
Christoph Avatar answered Nov 15 '22 09:11

Christoph