1
votes

I want to fit a function f(x) to my data in gnuplot. But I only want to use points at the beginning and at the end of my datafile (without points in the midrange). For example, my datafile contains 100 datapoints and I want to use data 1 to 20 and 80 to 100 for my data fitting (without 21 to 79).

Is is possible without changing my datafile (which contains all 100 datapoints)?

Best

1

1 Answers

0
votes

If you're using Linux/Unix, you can use, for example, head and tail:

f(x)=a+b*x
fit f(x) "<(head -n 20 data.dat && tail -n 21 data.dat)" via a,b
plot "data.dat" w p, a+b*x w l