ziulfer
ziulfer

Reputation: 1369

Loop over a constant value in gnuplot

I want to plot a function like:

f(x)= a * exp (-b *x)

on gnuplot, for different values of a and b.

Is it possible to make a for-loop over constant values in gnuplot?

Upvotes: 0

Views: 341

Answers (1)

sweber
sweber

Reputation: 2976

Yes, it works like this:

plot for [a=1:3] for [b=1:3] f(x) title sprintf("a=%d b=%d", a, b)

The syntax is

for [ variable = start : stop ]

However, only integer values can be used this way.

Here is the output for the command above. I used set log y to make it more visible.

enter image description here

Upvotes: 3

Related Questions