Hello,
I need to fit a function to my data over two disjointed ranges on the x axis at the same time.
Is there a way of the type 'fit f(x) [x=xmin:xmax][x=xmin1:xmax2] to do this?
Unfortunately, Gnuplot will interpret the second range as a y-range even if I specify that the variable is x.
Any suggestions?
Thank you in advance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok, thank you. And what if I want to associate a certain data set to the first interval and another data set to the second? How do I make the fit (or even the plot)?
I tried
(the fit command should be similar), but without success.
Finally, what if I want to do the same with 3 data sets (say i=0 in [xmin:xmax], i=6 in [xmin1:xmax1] and i=8 in [xmin2:xmax2]?
Last edit: peterp 2015-08-22
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I need to fit a function to my data over two disjointed ranges on the x axis at the same time.
Is there a way of the type 'fit f(x) [x=xmin:xmax] [x=xmin1:xmax2] to do this?
Unfortunately, Gnuplot will interpret the second range as a y-range even if I specify that the variable is x.
Any suggestions?
Thank you in advance.
You can invalidate the data points which are outside of the two ranges with
Ok, thank you. And what if I want to associate a certain data set to the first interval and another data set to the second? How do I make the fit (or even the plot)?
I tried
plot 'datafile' (($1>=xmin && $1 <= xmax) || ($1 >= xmin1 && $1 <= xmax1) ? (i i0) : (i i1))
(the fit command should be similar), but without success.
Finally, what if I want to do the same with 3 data sets (say i=0 in [xmin:xmax], i=6 in [xmin1:xmax1] and i=8 in [xmin2:xmax2]?
Last edit: peterp 2015-08-22