SETRATE

Purpose:

Sets the sample rate of a uniformly sampled series.

Syntax:

SETRATE(series, Fs)

series

-

Optional. A series or table, defaults to the current Window.

Fs

-

A real, the new sample rate.

col

-

Optional. An integer, the column number. Defaults to -1 for all columns.

Example:

setrate(5.0)

 

sets the current RATE to 5.0, i.e. 5 samples per second or equivalently a DELTAX of 0.2 seconds per sample if the horizontal units are seconds.

Example:

a = 1..100;

setrate(a, 3);

 

sets the RATE of variable a to 3, i.e. 3 samples per second or equivalently a DELTAX of 1/3 seconds per sample if the horizontal units are seconds.

Example:

W1: randn(100, 3);setrate(10.0, 2)

W2: col(w1, 1)

W3: col(w1, 2)

W4: col(w1, 3)

 

W1 contains a 10x3 random array with a default sample rate of 1.0. The rate of the second column is explicitly set to 10.0 samples per second.

 

W2 contains column 1 of W1 where rate(w2) == 1.

 

W3 contains column 2 of W1 where rate(w3) == 10.

 

W4 contains column 3 of W1 where rate(w3) == 1.

Remarks:

By default, SETRATE changes the sample rate of each column of data to the new rate. For example,

 

ravel({1, 3, 5}, grandom(3, 0.1)); setrate(100)

 

sets the rate of the generated series in column 1 as well as the generated random series in column 2 to 100.

 

The RATE of a series is the inverse of the DELTAX:

 

image\fsdx.gif

 

Many series have X values that are monotonically rising by a constant X increment such that:

 

image\xy01.gif

 

A series with X values of this form is referred to as an interval series. Because any X value from an interval series can be computed with:

 

image\XY02.gif

 

an interval series requires only the RATE or DELTAX and XOFFSET values to determine the X values. Thus, for an interval series, explicit X values are not necessary, decreasing the data storage requirements by a factor of 2. Also, because the X values for an interval series are regularly monotonic, speed optimizations for plotting and computations are available.

 

See SETDELTAX to set the DELTAX of a series.

 

See XY to create a series with irregularly spaced X values.

See Also:

DELTAX

DELTAY

RATE

SETDELTAX

SETDELTAY

SETHUNITS

SETXOFFSET

SETYOFFSET

XOFFSET

XY

YOFFSET