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


Groups > comp.graphics.apps.gnuplot > #2768

Re: fit two variables to a complex function

Newsgroups comp.graphics.apps.gnuplot
Date 2015-02-19 15:38 -0800
References <ab8d731f-9d22-4a55-8ecd-12d540e2de8e@googlegroups.com> <mc4v7n$5m2$1@news.rz.uni-karlsruhe.de> <mc532c$959$1@news.rz.uni-karlsruhe.de>
Message-ID <826ea7e1-cccb-4583-af15-4c4b758bcce7@googlegroups.com> (permalink)
Subject Re: fit two variables to a complex function
From luis <lamr64@gmail.com>

Show all headers | View raw


On Thursday, February 19, 2015 at 8:30:05 AM UTC-8, Karl wrote:
> Am 19.02.2015 um 16:24 schrieb Karl:
> > Am 19.02.2015 um 01:36 schrieb :
> >> Hi,
> >> I'm trying to fit a two parameter complex f(freq,temp) function to a dataset. Since I know that I can't really use complex-valued functions I'm following the advice I found on line: I split my data file so that I have the first dataset on the file be the real part and the second the imaginary part. My problem is that all the examples on the web use the second argument on the function to switch between the real and the imaginary functions to fit, so I'm not sure if it is even possible. I tried to use the column function like so:
> >>
> >> f2(x,t) = ((column(-2)%2)==0) ? Re_f(x,t) : Im_f(x,t)
> >>
> >> but I get, not completely unexpectedly:
> >>
> >> fit f2(x,y) DATAFILE every ::9 using 1:2:9:11 via A0
> >> column() called from invalid context
> >>
> >> if, stretching some of the examples, I try:
> >>
> >> f2(x,t,z) = (z==0) ? f(x,t) : phi(x,t)
> >> fit f2(x,y,z) DATAFILE every ::9 using 1:2:-1:9:11 via A0
> >>
> >> I get:
> >>
> >> undefined variable: z
> >>
> >> Any ideas?
> >>
> >> Thanks
> > 
> > Can“t you just make the temperature your switch, by feeding a negative T
> > value for the imaginary dataset?
> > 
> > f2(x,t) = ((column(-2)%2)==0) ? Re_f(x,t) : Im_f(x,-t)
> > 
> > fit f2(x,y) DATAFILE every ::9 \
> >    using 1:((column(-2)%2) == 0 ? $1 : -$1):9:11 via A0
> > 
> 
> This of course couldn't work, because column() can only be used in the
> using statement. That one here does the trick, however:
> 
> f(x,y) = (y>0) ? Re_f(x,y) : Im_f(x,-y)
> 
> fit f(x,y) "data" \
> 	us 1:2:(column(-2)%2==0?$3:-$3) via a
> 
> You could even use an imaginary independent variable to switch between
> the two parts, i guess. In case you need negative temperatures ;-)
> 
>   K

Yes, I like that. I think that should work ... Thanks!

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

fit two variables to a complex function lamr64@gmail.com - 2015-02-18 16:36 -0800
  Re: fit two variables to a complex function Karl <mail.kfr@gmx.net> - 2015-02-19 16:24 +0100
    Re: fit two variables to a complex function Karl <mail.kfr@gmx.net> - 2015-02-19 16:36 +0100
    Re: fit two variables to a complex function Karl <mail.kfr@gmx.net> - 2015-02-19 17:30 +0100
      Re: fit two variables to a complex function luis <lamr64@gmail.com> - 2015-02-19 15:38 -0800
      Re: fit two variables to a complex function Karl <mail.kfr@gmx.net> - 2015-02-25 23:59 +0100

csiph-web