Very simple command to best fit using gnuplot

How calculate and plot a linear best fit using gnuplot with only a subset of data-file?
to generate an output like this:


you should use a command such:
f(x) = a * x + b
fit f(x) "datafile.data" every ::15:0:30:0
plot "datafile.data" ,  f(x)

It means that gnuplot perform the best fit calculation only for data from row 15 to row 30.

May be usefull select visually the subset of data to fitting in this way:
plot "datafile.data" every ::15:0:30:0 , ""


different color help you to select the desired subsection without modify the original data-file.

Nessun commento:

Posta un commento