SamplingRate (FPScript)

21.09.2021

Determines the sampling rate of a data set or of its X component with linearly increasing or decreasing values.

Syntax

SamplingRate(DataSet)

 

The syntax of the SamplingRate function consists of the following parts:

Part

Description

DataSet

The data set whose sampling rate is determined.

All data structures are allowed, except scalar value und list. Not supported data types arestring.

Remarks

As the result the function returns a scalar value of data type 64-bit floating point.

The result has the same unit as the argument DataSet.

For signals, signal series and space curves, only the X component is analyzed. The sampling rate corresponds to the reciprocal of the difference of consecutive values in the data set. The increments between neighboring values do not, however, have to be exactly the same, but may deviate by a maximum of 1 %. If this tolerance band is exceeded, if the increment is equal to zero, if the data set does not contain at least two values, or if it contains void values, then a void floating point value is returned. Otherwise, the reciprocal of the increment between the first and second value is returned.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

For complex data types the absolute value is formed.

Available in

FlexPro View, Basic, Professional, Developer Suite

Examples

SamplingRate({1, 3, 5})

Results in 0.5.

SamplingRate({1, 1, 1})

Results in ?.

SamplingRate({1, 2.001, 3})

Results in 0.999000999.

SamplingRate({1, 2, 3.001})

Results in 1..

SamplingRate({1, 2.1, 3})

Results in ?.

SamplingRate({1, 2, ?, 4})

Results in ?.

SamplingRate((10, 0 s, 0.5 s))

Results in 2 Hz.

SamplingRate(Signal({1 V, 1.5 V }, 0.5 ms))

Results in 2 kHz.

See Also

Increment Function

DataOrder Function

Share article or send as email:

You might be interested in these articles