Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2273 > unrolled thread

how to fit a dataset which consists of two parts with two different errors

Started by"hugocoolens@gmail.com" <hugocoolens@gmail.com>
First post2014-01-28 05:20 -0800
Last post2014-02-01 00:40 -0800
Articles 6 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  how to fit a dataset which consists of two parts with two different errors "hugocoolens@gmail.com" <hugocoolens@gmail.com> - 2014-01-28 05:20 -0800
    Re: how to fit a dataset which consists of two parts with two different errors Karl <mail.kfr@gmx.net> - 2014-01-28 17:50 +0100
      Re: how to fit a dataset which consists of two parts with two different errors "hugocoolens@gmail.com" <hugocoolens@gmail.com> - 2014-01-30 22:46 -0800
      Re: how to fit a dataset which consists of two parts with two different errors "hugocoolens@gmail.com" <hugocoolens@gmail.com> - 2014-01-31 08:29 -0800
        Re: how to fit a dataset which consists of two parts with two different errors Karl <mail.kfr@gmx.net> - 2014-01-31 18:10 +0100
          Re: how to fit a dataset which consists of two parts with two different errors "hugocoolens@gmail.com" <hugocoolens@gmail.com> - 2014-02-01 00:40 -0800

#2273 — how to fit a dataset which consists of two parts with two different errors

From"hugocoolens@gmail.com" <hugocoolens@gmail.com>
Date2014-01-28 05:20 -0800
Subjecthow to fit a dataset which consists of two parts with two different errors
Message-ID<9e2a6f3e-0d79-4484-8a60-529a57901c55@googlegroups.com>
I have to fit a dataset which consists of two parts: a part from 10e-6 to 1e-3
which has errorbars (0.01*0.033*$2+2e-9) and a second part from >1e-3 to 10e-3
which has errorbars (0.01*0.035*$2+600e-9)

Is it possible to give one fit command that uses the information here above
similar to the statement below but working for all the data?


fit f(x) 'mydata.dat' using ($1):($2):(0.01*0.035*$2+600e-9) via a,b


thanks
hugo

[toc] | [next] | [standalone]


#2274

FromKarl <mail.kfr@gmx.net>
Date2014-01-28 17:50 +0100
Message-ID<lc8n57$gch$1@news.rz.uni-karlsruhe.de>
In reply to#2273
Am 28.01.2014 14:20, schrieb hugocoolens@gmail.com:
> 
> I have to fit a dataset which consists of two parts: a part from 10e-6 to 1e-3
> which has errorbars (0.01*0.033*$2+2e-9) and a second part from >1e-3 to 10e-3
> which has errorbars (0.01*0.035*$2+600e-9)
> 
> Is it possible to give one fit command that uses the information here above
> similar to the statement below but working for all the data?
> 
> 
> fit f(x) 'mydata.dat' using ($1):($2):(0.01*0.035*$2+600e-9) via a,b
> 

You can use the ternary operator "a?b:c".

error(x) = (x < 1e-3) ? (0.01*0.033*$2+2e-9) : (0.01*0.035*$2+600e-9)

fit f(x) 'mydata.dat' using ($1):($2):(error($2)) via a,b


 K

[toc] | [prev] | [next] | [standalone]


#2281

From"hugocoolens@gmail.com" <hugocoolens@gmail.com>
Date2014-01-30 22:46 -0800
Message-ID<2a28d9ae-eff1-402c-a98e-d26655ed6f7f@googlegroups.com>
In reply to#2274
Op dinsdag 28 januari 2014 17:50:47 UTC+1 schreef Karl:
> Am 28.01.2014 14:20, schrieb hugocoolens@gmail.com:
> > 
> > I have to fit a dataset which consists of two parts: a part from 10e-6 to 1e-3
> > which has errorbars (0.01*0.033*$2+2e-9) and a second part from >1e-3 to 10e-3
> > which has errorbars (0.01*0.035*$2+600e-9)
> > 
> > Is it possible to give one fit command that uses the information here above
> > similar to the statement below but working for all the data?
> > 
> > 
> > fit f(x) 'mydata.dat' using ($1):($2):(0.01*0.035*$2+600e-9) via a,b
> > 
>
> You can use the ternary operator "a?b:c".
>
> error(x) = (x < 1e-3) ? (0.01*0.033*$2+2e-9) : (0.01*0.035*$2+600e-9)
>
> fit f(x) 'mydata.dat' using ($1):($2):(error($2)) via a,b
>
>
>  K
Thank you very much, this was exactly what I needed!
hugo

[toc] | [prev] | [next] | [standalone]


#2283

From"hugocoolens@gmail.com" <hugocoolens@gmail.com>
Date2014-01-31 08:29 -0800
Message-ID<dc8cfb92-c247-4be8-bc95-5ce4984ace31@googlegroups.com>
In reply to#2274
Op dinsdag 28 januari 2014 17:50:47 UTC+1 schreef Karl:
> Am 28.01.2014 14:20, schrieb hugocoolens@gmail.com:
> 
> > 
> 
> > I have to fit a dataset which consists of two parts: a part from 10e-6 to 1e-3
> 
> > which has errorbars (0.01*0.033*$2+2e-9) and a second part from >1e-3 to 10e-3
> 
> > which has errorbars (0.01*0.035*$2+600e-9)
> 
> > 
> 
> > Is it possible to give one fit command that uses the information here above
> 
> > similar to the statement below but working for all the data?
> 
> > 
> 
> > 
> 
> > fit f(x) 'mydata.dat' using ($1):($2):(0.01*0.035*$2+600e-9) via a,b
> 
> > 
> 
> 
> 
> You can use the ternary operator "a?b:c".
> 
> 
> 
> error(x) = (x < 1e-3) ? (0.01*0.033*$2+2e-9) : (0.01*0.035*$2+600e-9)
> 
> 
> 
> fit f(x) 'mydata.dat' using ($1):($2):(error($2)) via a,b
Could this idea be expanded somehow to more than two sections?

thanks in advance
hugo

[toc] | [prev] | [next] | [standalone]


#2284

FromKarl <mail.kfr@gmx.net>
Date2014-01-31 18:10 +0100
Message-ID<lcgldj$vjn$1@news.rz.uni-karlsruhe.de>
In reply to#2283
Am 31.01.2014 17:29, schrieb hugocoolens@gmail.com:

>>
>> You can use the ternary operator "a?b:c".
>>
>>
>>
>> error(x) = (x < 1e-3) ? (0.01*0.033*$2+2e-9) : (0.01*0.035*$2+600e-9)
>>
>>
>>
>> fit f(x) 'mydata.dat' using ($1):($2):(error($2)) via a,b
> Could this idea be expanded somehow to more than two sections?
> 

(The $2´s in my first error function should of course have been x´es)

Well, just nest more ternary operators:

error(x) = (x < 0) ? .1*x : (x < 1) ? .2*x : .1*x

gives 0.2x between 0 and 1, 0.1x everywhere else.

I wonder if i got your original question right, however. Isn´t this more
what you had in mind:

err1(y) = y*0.01  # first region gets 1% error
err2(y) = y*0.02  # second region gets 2%

error(x,y) = (x<1) ? err1(y) : err2(y)

plot "" using 1:2:(error($1,$2))

[toc] | [prev] | [next] | [standalone]


#2287

From"hugocoolens@gmail.com" <hugocoolens@gmail.com>
Date2014-02-01 00:40 -0800
Message-ID<243eb3a3-7541-472d-b2a0-f4b29e350d95@googlegroups.com>
In reply to#2284
Op vrijdag 31 januari 2014 18:10:12 UTC+1 schreef Karl:
> Am 31.01.2014 17:29, schrieb hugocoolens@gmail.com:
>
> >>
> >> You can use the ternary operator "a?b:c".
> >>
> >>
> >>
> >> error(x) = (x < 1e-3) ? (0.01*0.033*$2+2e-9) : (0.01*0.035*$2+600e-9)
> >>
> >>
> >>
> >> fit f(x) 'mydata.dat' using ($1):($2):(error($2)) via a,b
> > Could this idea be expanded somehow to more than two sections?
> > 
>
> (The $2´s in my first error function should of course have been x´es)
>
> Well, just nest more ternary operators:
>
> error(x) = (x < 0) ? .1*x : (x < 1) ? .2*x : .1*x
>
> gives 0.2x between 0 and 1, 0.1x everywhere else.
>
> I wonder if i got your original question right, however. Isn´t this more
> what you had in mind:
>
> err1(y) = y*0.01  # first region gets 1% error
> err2(y) = y*0.02  # second region gets 2%
>
> error(x,y) = (x<1) ? err1(y) : err2(y)
>
> plot "" using 1:2:(error($1,$2))

Now I got it completely right, thank  you very much Karl, you made my day

kind regards,
hugo

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web