Resample (FPScript)

21.09.2021

Increases or reduces a data set's sampling rate.

Syntax

Resample(DataSet, Factor [ , Method = RESAMPLE_FFT ])

 

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

Part

Description

DataSet

The data set for which the number of values is to be reduced.

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

For the X component additional restrictions do apply. The values must have a constant spacing.

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

Factor

Specifies the factor by which the sampling rate, and thus the number of values in the result, is to be changed. Values less than one reduce the sampling rate, and values greater than one increase it.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

The value must be greater than 0.

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.

Method

Determines the method used to resample.

The argument Method can have the following values:

Constant

Meaning

RESAMPLE_LINEAR

Resampling occurs using linear interpolation.

RESAMPLE_FFT

Resampling occurs using Exact-n FFT.

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 RESAMPLE_FFT.

Remarks

If DataSet does not contain an X component, then the X values are automatically generated starting with zero and in increments of one. If it contains an X component, then this must have a constant increment, i.e. the data must be sampled using a constant rate. The result is always a signal or a signal series.

For resampling using FFT, the time signal is first transformed into the frequency domain. To increase the sampling rate, zeros are then appended to the spectrum, and to reduce the sampling rate, a part of the spectrum is correspondingly cut off. It is then transformed again into the time domain. Resampling using the Fourier transform leads to an almost ideal result, since no high frequency signal components are added when the sampling rate is increased and all spectral components up to the new Nyquist frequency remain when the sampling rate is reduced. Exact reconstruction of the original time signal is, however, not always possible due to the leakage effect of the FFT.

Ideally, the new number of values is (NumberOfRows(DataSet)-1) * Factor + 1, rounded to the next integer. This, however, is not always possible for the FFT method (for non-integer values of Factor).

Available in

FlexPro Basic, Professional, Developer Suite

Examples

Resample(Signal, 2)

Doubles a signal's sampling rate using the FFT method.

Resample(Signal, 0.5, RESAMPLE_LINEAR)

Halves a signal's sampling rate using linear interpolation.

See Also

LinearInterpolation Function

DeltaCompress Function

Sample Function

Expand Function

Reduce Function

Signal Sampling Analysis Object

Share article or send as email:

You might be interested in these articles