Re: How to plot multiple fit functions in a single box

Norwid Behrnd via gnuplot-info <[email protected]>
Newsgroups gmane.comp.graphics.gnuplot.user
Message-ID <20200704181638.5ee0f6dc@carnot2>
Dear Rekha,

my understanding is that you have one file of data and the script may
perform the fits sequentially (using 1:2, using 1:3, using 1:4, etc.).
The structure of the underlying function seems to be the same for all of
them, too, f(x) = (a0 + a1/x).

May renaming the functions be an option for you, e.g. f1(x), f2(x), f3(x),
thus creating to discernible fits?  I speculate this requires some change
in the script used (the example covers only two data):

f1(x) = (a0 + a1/x)
fit f1(x) 'test.data' using 1:2 via a0,a1
plot 'test.data' using 1:2 w points pt 1 t  ,  f1(x) t sprintf("K_{fit} =
a_0 +  a_1/T", a0)

f2(x) = (a0 + a1/x)
fit f2(x) 'test.data' using 1:3 via a0,a1
plot  'test.data' using 1:3 w points pt 1 t   ,  f2(x) t sprintf("K_{fit} =
a_0 +  a_1/T", a0)

Using the integer count may yield a script easier to maintain and expand
than using a set of functions named with changing letters, e.g. f(x), g(x),
h(x), etc.

If so, because of similarity in these blocks and the predictable changes
between them, maybe this may be parameterized once; you would have one
block of definition only.  When calling for this function, its sole variable
then were n to perform n fits / plot n curves; there wouldn't be a need
to write n blocks (dry versus wet programming principle).

Norwid


_______________________________________________
gnuplot-info mailing list
[email protected]
Membership management via: https://lists.sourceforge.net/lists/listinfo/gnuplot-info
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.