Finding consecutive maxima and recording them

Hello,

I have a file with two columns (I uploaded it because it is some 500K):

File-Upload.net - data.dat

If you plot the data with, say, gnuplot,

plot 'data.dat' u 1:2 w l

you will see that there are jumps. This is actually an orbit and a maximum corresponds to an apocenter and a minimum to a pericenter.

I would like to calculate two things:

(1) The initial period: I.e. the separation in the X axis between the very first maximum and the second one.

(2) The instantaneous period: For a value of X what is the difference between the immediately previous maximum and the following one

Is it possible to do this without having to use R or so?

thanks

Perhaps include a small piece of the data file - many are cautious about downloading anything.
Explain the data a little.
And, define in words what you are trying to determine.

Not sure how many users here have ever used plot.
(For me, I have used Unix for years, but never heard of plot.)

thanks. The data are in ascii format. So once you edit it with vi you will realize that there is not danger in dowloading it.

I was posting the link because there are many maxima spread all over the file.

A screenshot of the figure is here:

http://www10.pic-upload.de/29.02.12/t2a923mue74l.png

X = time

Y = distance between two objects; let's say between two stars

The orbit is decaying as you can see, and a maximum corresponds to an apocenter (the two stars are at their maximum separation at that moment), and a minimum to a pericenter (minimum separation at that moment).

This corresponds to the first 600 lines, which contain the first two maxima. It is obvious to find these with sort or awk and then calculate the X separation between them.

But I want to do that for the whole range of Y, as well as the instantaneous period.

I.e. I want to have

"Separation in X between two consecutive maxima" vs. "X" for the whole file.

---------- Post updated at 03:50 PM ---------- Previous update was at 03:48 PM ----------

sorry, the first 600 lines are here

Upload Your content