|
From: Thomas S. <t.s...@fz...> - 2010-01-11 13:54:10
|
yulin chang wrote:
>
> For simplicity, suppose I had two data sets, both governed by a simple
> exponential decay with the same time constant but different initial
> values,
> i.e., z = a*exp(-t/T) for the first data set and z = b*exp(-t/T) for the
> second,
> and I want to fit the decay for both data sets with a common parameter T.
>
> In help fit multi-branch of gnuplot, it says
> "The function and parameters (branch) for each data set are selected by
> using a
> 'pseudo-variable', e.g., either the dataline number (a 'column' index of
> -1) or
> the datafile index (-2), as the second independent variable." and in the
> example
> it gives
> f(x,y) = (y==0) ? a*exp(-x/tau) : b*exp(-x/tau)
> fit f(x,y) 'datafile' using 1:-2:2:3 via a, b, tau
>
> Could anybody help me with the following?
> 1. How is f(x,y) switched between a*exp(-x/tau) and b*exp(-x/tau) in the
> fitting
> procedure? Specifically, when the fitting program read a line in the data
> file,
> it sees x:z (first column independent and second column dependent). How
> does the
> program decide which function to use? Since there is no 'y' involved.
>
sure there is a 'y' involved: it's the 2nd argument of the 'using'
specifier.
in detail:
using 1:-2:2:3
means:
the x-value is read from column 1
the y-value is the current index (=data block) number
the z-value is read from column 2
the s-value is read from column 3
so, if your two data sets are in one file - separated by two empty lines
- then the 1st data set will have the index number '0' and the 2nd index
'1'.
this index is given to the function as y-value which switches between the
two functions.
yulin chang wrote:
>
> 2. Could anybody give me an example of function and parameters selection
> using
> the dataline number (a 'column' index of -1)?
>
f(x,y) = (y<1000) ? a*exp(-x/tau) : b*exp(-x/tau)
fit f(x,y) 'datafile' using 1:-1:2:3 via a, b, tau
the 1st 1000 data sets (=lines) are fitted using the 1st function,
the remaining data sets are fitted using the 2nd function.
yulin chang wrote:
>
> Thanks you very much for your help,
> yulin
>
--
View this message in context: http://old.nabble.com/fit-multi-branch-%28simultaneous-fits-of-2-data-sets%29-tp27109307p27110571.html
Sent from the Gnuplot - User mailing list archive at Nabble.com.
|