I have a problem with the multi-branch fitting procedure. According to the manual it should be possible to execute a weighted fit. I have 1 independent variable (x), 2 dependent variables (y) and the 2 associated standard deviations (sy).
My file looks like this:
Column1...Column5
x y1 sy1 y2 sy2
and the "code"
f(x,y) = (y==0) ? A1(x,a,b) : A2(x,a,b)
fit f(x,y) 'file.txt' using 1:-2:2:4:3:5 yerror via a,b
My problem is, that I don't know how to sort the columns after using (1:-2:2:4:3:5 or 1:-2:2:3:4:5 ?) and what errorvariable belongs after the column index (yerror, zerror)?
Without weighting, using only 1:-2:2:4 everythings works, but with weighting it doesn't. I appreciate your help.
Greets wallies
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The problem addressed by the multi-branch fit as described in the manual/help is for fitting multiple (separate) datasets in one file. That is they can be distinguished e.g. by datafile index column(-2) and are of the form x:z:s (indep., dependent, error). From your description your problem is different, even in the non-weighted case as you have two dependent variables on the same line. For now I do not see a way to fit that using gnuplot without re-ordering your data file and then use the multi-branch approach:
Hello,
I have a problem with the multi-branch fitting procedure. According to the manual it should be possible to execute a weighted fit. I have 1 independent variable (x), 2 dependent variables (y) and the 2 associated standard deviations (sy).
My file looks like this:
Column1...Column5
x y1 sy1 y2 sy2
and the "code"
f(x,y) = (y==0) ? A1(x,a,b) : A2(x,a,b)
fit f(x,y) 'file.txt' using 1:-2:2:4:3:5 yerror via a,b
My problem is, that I don't know how to sort the columns after using (1:-2:2:4:3:5 or 1:-2:2:3:4:5 ?) and what errorvariable belongs after the column index (yerror, zerror)?
Without weighting, using only 1:-2:2:4 everythings works, but with weighting it doesn't. I appreciate your help.
Greets wallies
The problem addressed by the multi-branch fit as described in the manual/help is for fitting multiple (separate) datasets in one file. That is they can be distinguished e.g. by datafile index
column(-2)
and are of the form x:z:s (indep., dependent, error). From your description your problem is different, even in the non-weighted case as you have two dependent variables on the same line. For now I do not see a way to fit that using gnuplot without re-ordering your data file and then use the multi-branch approach:Where y11 denotes first y1 value, y1n n-th y1value etc.
The fit command would then look like
Exactly as described in
help fit multi-branch
.Hello Bastian,
thanks for your help. Had to use 1:-1:2:3 instead of your suggestion, but it works now.