TIMESYNC

Purpose:

Time synchronization of two series by resampling and extraction.

Syntax:

TIMESYNC(s1, s2, fs)

s1

-

A series, the first series.

s2

-

A series, the second series.

fs

-

Optional. A real, the new sample rate. Defaults to -1, the maximum rate of s1 and s2;

Returns:

A stripchart of the resulting resampled series.

 

(y1, y2) = timesync(w1, w2, fs) returns the synched series as separate series.

Example:

W1: 1..10;settime(w0, "12:00");sethunits("Time")

W2: 3..0.1..20;settime(w0, "12:00");sethunits("Time")

W3: timesync(w1, w2)

 

The series in W1 starts at 12:00:01 and contains 10 samples.

 

The series in W2 starts at 12:00:03 and contains 171 samples.

 

The sample rate of W1 is 1 Hz and the sample rate of W2 is 10 Hz.

 

W3 contains a stripchart with a sample rate of 10 Hz. Both series start at 12:00:03. The first trace of the stripchart is produced by extracting from the 3rd sample of W1, the index of W1 that corresponds to the starting time of W2.

Example:

W1: 1..10;settime(w0, "12:00");sethunits("Time")

W2: 3..0.1..20;settime(w0, "12:00");sethunits("Time")

W3: timesync(w2, w1)

 

Same as above except the input series are swapped. The start time of the resulting series is 12:00:01 and the sample rate is 10 Hz. The first trace of W3 is produced by prepending 20 zeros to W2.

Example:

W1: 1..10;settime(w0, "12:00");sethunits("Time")

W2: 3..0.1..20;settime(w0, "12:00");sethunits("Time")

W3: timesync(w2, w1, 15.0)

 

Same as above except the output sample rate is set to 15 Hz.

Remarks:

TIMESYNC synchronizes series s1 to series s2 by adjusting the starting index of s1 to match the wall clock starting time of s2. The adjustment is achieved by extracting or prepending samples to s1.

 

Both series are resampled to fs to produce a point by point correspondence between the resulting series.

 

If fs < 0 or unspecified, the sample rate is set to the largest (fastest) rate of the two input series.

 

Both input series should have horizontal units (i.e. X units) of "Time" or "Real Time" to yield wall clock synchronization.

 

TIMESYNC resamples XY input series to regularly sampled interval series.

 

See OVERLAYXSYNC to synchronize one or more overlays based on the X axis.

See Also:

EXTRACT

OVERLAYXSYNC

RESAMPLE

SETHUNITS

STRIPCHART

XTOIDX