Sample (FPScript)

21.09.2021

Samples a signal using linear interpolation.

Syntax

Sample(Signal, X [ , Extrapolate = FALSE ])
or
Sample(Amplitude, Time, X [ , Extrapolate = FALSE ])

 

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

Part

Description

Signal

The data set to be sampled.

Permitted data structures are data series, data matrix, signal und signal series. All numeric data types are permitted.

For complex data types the absolute value is formed.

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

Amplitude

The Y component of the signal to be sampled. If you specify a signal, then its Y component is used.

Permitted data structures are data series, data matrix, signal und signal series. All numeric data types are permitted.

For complex data types the absolute value is formed.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Time

The X component of the signal to be sampled. If you specify a signal, then its Y component is used.

Permitted data structures are data series und signal. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

X

A scalar value or a data series with the X values, at which the signal is to be sampled, or a signal or a signal series to be transformed using the characteristic curve specified as the first argument.

Permitted data structures are scalar value, data series, data matrix, signal und signal series. All numeric data types are permitted.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Extrapolate

The value TRUE specifies that the signal to be sampled should be linearly extrapolated at the edges.

Permitted data structures are scalar value. Supported data types are Boolean value.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value FALSE.

Remarks

The result always has the data type 64-bit floating point.

Typical applications for this function are adapting the sampling rates of two signals, sampling a signal at X positions, at which there is no sampling point, and transforming a signal via a characteristic curve specified as a data set.

If the X values specified do not correspond exactly to a sampling point of the signal, linear interpolation will take place. For X values that lie before the first or after the last X value of the signal, the result depends on the Extrapolate argument. If this is FALSE, a void value is passed as the result; otherwise, linear extrapolation is carried out using both the first and last points in Signal.

If X was specified as a scalar value, the result is also a scalar value. Otherwise, the variant with two arguments, or if X is a signal, returns a signal, and the variant with three arguments returns a data series as the result.

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Sample(Signal, 1.5 s)

Evaluates a signal at the position X=1.5 s.

Sample(Signal2, Signal1.x)

Adjusts the sampling rate of 'Signal2' to that of 'Signal1'.

Sample(CharacteristicCurve, Signal)

Transforms a signal using a characteristic curve.

See Also

LinearInterpolation Function

DeltaCompress Function

Resample Function

Expand Function

Reduce Function

Signal Sampling Analysis Object

Index Operator

Share article or send as email:

You might be interested in these articles