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


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

can I fit two columns when I use timefmt

Started byJean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr>
First post2017-10-24 13:30 +0200
Last post2017-10-25 01:01 +0200
Articles 9 — 4 participants

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


Contents

  can I fit two columns when I use timefmt Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2017-10-24 13:30 +0200
    Re: can I fit two columns when I use timefmt Jörg Buchholz <bookwood4new@freenet.de> - 2017-10-24 14:19 +0200
      Re: can I fit two columns when I use timefmt Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2017-10-24 15:13 +0200
        Re: can I fit two columns when I use timefmt Karl Ratzsch <mail.kfr@gmx.net> - 2017-10-24 16:04 +0200
          Re: can I fit two columns when I use timefmt Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2017-10-25 08:10 +0200
            Re: can I fit two columns when I use timefmt Karl Ratzsch <mail.kfr@gmx.net> - 2017-10-25 09:18 +0200
              Re: can I fit two columns when I use timefmt Jean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr> - 2017-10-25 14:35 +0200
        Re: can I fit two columns when I use timefmt Jörg Buchholz <bookwood4new@freenet.de> - 2017-10-25 07:43 +0200
    Re: can I fit two columns when I use timefmt Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2017-10-25 01:01 +0200

#3788 — can I fit two columns when I use timefmt

FromJean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr>
Date2017-10-24 13:30 +0200
Subjectcan I fit two columns when I use timefmt
Message-ID<alpine.WNT.2.20.1710241324490.5548@dhcp3-6>
I have a datafile with lines like 171023_15h11m59s150 <value2> <value3>.
I know how to plot columns 2 and 3 using set xdata time; set timefmt
"%y%m%d_%Hh%Mm%Ss"

My model is a = .028; b=.04; model(x) = a*x + b. When I say
fit modele(x) "mystuff.txt" using 2:3 via a, b I obtain: No data to fit

What is the right way to do?

Regards,
-- 
Jean-Pierre Coulon

[toc] | [next] | [standalone]


#3789

FromJörg Buchholz <bookwood4new@freenet.de>
Date2017-10-24 14:19 +0200
Message-ID<osnb4k$qib$1@dont-email.me>
In reply to#3788
On 24.10.2017 13:30, Jean-Pierre Coulon wrote:
> I have a datafile with lines like 171023_15h11m59s150 <value2> <value3>.
> I know how to plot columns 2 and 3 using set xdata time; set timefmt
> "%y%m%d_%Hh%Mm%Ss"

You plot value2 and value3 by using value1 (your time data) as x value?

plot 'datafile' u 1:2, '' u 1:3

> My model is a = .028; b=.04; model(x) = a*x + b. When I say
> fit modele(x) "mystuff.txt" using 2:3 via a, b I obtain: No data to fit

Here you use value2 as xdata and they don't have a timeformat.

> What is the right way to do?

Before fitting 2:3 unset xdata time by using

set xdata

Jörg

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


#3790

FromJean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr>
Date2017-10-24 15:13 +0200
Message-ID<alpine.WNT.2.20.1710241500370.5548@dhcp3-6>
In reply to#3789
On Tue, 24 Oct 2017, Jörg Buchholz wrote:

> On 24.10.2017 13:30, Jean-Pierre Coulon wrote:
>> I have a datafile with lines like 171023_15h11m59s150 <value2> <value3>.
>> I know how to plot columns 2 and 3 using set xdata time; set timefmt
>> "%y%m%d_%Hh%Mm%Ss"
>
> You plot value2 and value3 by using value1 (your time data) as x value?
>
> plot 'datafile' u 1:2, '' u 1:3

This already works fine.

>> My model is a = .028; b=.04; model(x) = a*x + b. When I say
>> fit modele(x) "mystuff.txt" using 2:3 via a, b I obtain: No data to fit
>
> Here you use value2 as xdata and they don't have a timeformat.
>
>> What is the right way to do?
>
> Before fitting 2:3 unset xdata time by using
>
> set xdata

Thanks. It works if I also say unset xrange. In this case I also have a first 
column in simple integers and the 2nd column is in time format. I was plotting 
with using 2:<other column>. Does Gnuplot use this 1srt column for the fit 
if I say fit using <two other columns> ?

Jean-Pierre Coulon

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


#3792

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2017-10-24 16:04 +0200
Message-ID<osnh8j$4it$1@solani.org>
In reply to#3790
Am 24.10.2017 um 15:13 schrieb Jean-Pierre Coulon:
> 
> Thanks. It works if I also say unset xrange. In this case I also have a first 
> column in simple integers and the 2nd column is in time format. I was plotting 
> with using 2:<other column>. Does Gnuplot use this 1srt column for the fit 
> if I say fit using <two other columns> ?

No, it does only use the specified columns. But your naming scheme in
not clear to me.

You have a datafile with columns t, p(t), q(t), right?

Now what does model(x) describe?

p(t), q(t), or q(p(t))

? Is x=t, or is x=p(t) ?


  Karl

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


#3802

FromJean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr>
Date2017-10-25 08:10 +0200
Message-ID<alpine.WNT.2.20.1710250754530.10296@dhcp3-6>
In reply to#3792
On Tue, 24 Oct 2017, Karl Ratzsch wrote:

> Am 24.10.2017 um 15:13 schrieb Jean-Pierre Coulon:
>>
>> Thanks. It works if I also say unset xrange. In this case I also have a first
>> column in simple integers and the 2nd column is in time format. I was plotting
>> with using 2:<other column>. Does Gnuplot use this 1srt column for the fit
>> if I say fit using <two other columns> ?
>
> No, it does only use the specified columns. But your naming scheme in
> not clear to me.
>
> You have a datafile with columns t, p(t), q(t), right?

My datafile contains these columns: 1: time in seconds, integer 2: time in 
%y%m%d_%Hh%Mm%Ss format 3: p(t) 4: q(t) I am happy with my plots using 2:3 or 
2:4 with timefmt = this format. And I am able to select an xrange by putting 
my 2 limits in this format in the set xrange statement.

> Now what does model(x) describe?

p(t) = a*q(t) + b

and it works if I say fit model(x) datafile using 4:3 via a b.

How can I limit the range to the last two thirds of my datafile? My columns 3 
and 4 are not monotonic.
-- 
Jean-Pierre Coulon

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


#3803

FromKarl Ratzsch <mail.kfr@gmx.net>
Date2017-10-25 09:18 +0200
Message-ID<ospds1$ar1$1@solani.org>
In reply to#3802
Am 25.10.2017 um 08:10 schrieb Jean-Pierre Coulon:
> On Tue, 24 Oct 2017, Karl Ratzsch wrote:
> 
>> You have a datafile with columns t, p(t), q(t), right?
> 
> My datafile contains these columns: 1: time in seconds, integer 2:
> time in %y%m%d_%Hh%Mm%Ss format 3: p(t) 4: q(t) I am happy with my
> plots using 2:3 or 2:4 with timefmt = this format. And I am able to
> select an xrange by putting my 2 limits in this format in the set
> xrange statement.
> 

Ah. That's imo not what you initially described (see your first
post). Nevermind.

>> Now what does model(x) describe?
> 
> p(t) = a*q(t) + b
> 
> and it works if I say fit model(x) datafile using 4:3 via a b.
> 
> How can I limit the range to the last two thirds of my datafile? My
> columns 3 and 4 are not monotonic.

So you want to correlate columns 3 and 4, but limit the range
according to column 1 (or 2) ? Got it.

You can

   fit model(x) dataf  us 3:($1<start?NaN:$1>end?NaN:$4) via a,b

, that just reads in NaN for any line where $1 is out of range. You
might use "stats" to set the range limiters.

  Karl

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


#3805

FromJean-Pierre Coulon <coulon@cacas.pam.obs-nice.fr>
Date2017-10-25 14:35 +0200
Message-ID<alpine.WNT.2.20.1710251423270.11656@dhcp3-6>
In reply to#3803
On Wed, 25 Oct 2017, Karl Ratzsch wrote:

> So you want to correlate columns 3 and 4, but limit the range
> according to column 1 (or 2) ? Got it.
>
> You can
>
>   fit model(x) dataf  us 3:($1<start?NaN:$1>end?NaN:$4) via a,b
>
> , that just reads in NaN for any line where $1 is out of range. You
> might use "stats" to set the range limiters.

Thanks, it works!
-- 
Jean-Pierre Coulon

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


#3801

FromJörg Buchholz <bookwood4new@freenet.de>
Date2017-10-25 07:43 +0200
Message-ID<osp8af$2u2$1@dont-email.me>
In reply to#3790
On 24.10.2017 15:13, Jean-Pierre Coulon wrote:

> Thanks. It works if I also say unset xrange. In this case I also have a
> first column in simple integers and the 2nd column is in time format. I
> was plotting with using 2:<other column>. Does Gnuplot use this 1srt
> column for the fit if I say fit using <two other columns> ?

It is really helpful if you can give some real lines of your datafile
and your real plot and fit command.

I found a tip that gnuplot handles timeformat data in the fit command as
seconds. So you must adjust your starting variables to this.

<https://stackoverflow.com/questions/29445324/fit-to-time-series-using-gnuplot>

Jörg

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


#3799

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2017-10-25 01:01 +0200
Message-ID<f59v2oFnu71U1@mid.dfncis.de>
In reply to#3788
Am 24.10.2017 um 13:30 schrieb Jean-Pierre Coulon:
> I have a datafile with lines like 171023_15h11m59s150 <value2> <value3>.
> I know how to plot columns 2 and 3 using set xdata time; set timefmt
> "%y%m%d_%Hh%Mm%Ss"

Those two sentences (with the context you added in your reply) 
contradict each other.  Either that's not actually what your lines look 
like, or you're not plotting them using the plot command you say you are.

I think it's time you change from "lines like" to you showing some or 
all of your actual data lines, and from "I know how to" to "this is the 
actual command sequence I use", otherwise there's no way to help you 
meaningfully.

[toc] | [prev] | [standalone]


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


csiph-web