Jan
Jan

Reputation: 97

print fitting results to terminal in Gnuplot

I want to perform a really simple task, which I just can't achieve myself. I want to use fitting parameters, e.g. a1, a2, a3, do some basis mathematics with it and print the result to my terminal as a simple output (like cout "Hello World").

I want something like this in Gnuplot:

print 'the result C = a0+a1+a2'

And an output like (e.g. if all parameters are equal to 1)

the result C = 3

Many thanks in advance

Upvotes: 0

Views: 962

Answers (2)

sweber
sweber

Reputation: 2996

If you also need errors, do this:

set fit errorvariables
fit ...
print sprintf(' a0 has been determined to %d  +/- %d', a0, a0_err)

Due to the set fit command, there will be an additional variable *_err" for each variable after the fit.

Upvotes: 1

Christoph
Christoph

Reputation: 48430

Use sprintf to format a string based on some variables:

print sprintf('the result is C = %.2f', a0 + a1 + a2)

Upvotes: 1

Related Questions