LTPDA Toolbox™ | contents |
Resampling is the process of changing the sampling rate of data. The method ao/resample changes the sampling rate of the input AOs to the desired output sampling frequency by performing band-limited interpolation, or interpolation.
If the ratio of the input and the desired output sample rate can be expressed as an integer ratio P/Q where both P and Q then band-limited interpolation can be performed. In this case, the data-series is upsampled (by inserting zeros) and then a low-pass filter is applied at the original Nyquist frequency.
The ao/resample method can be called with the syntax:
b = resample(a, pl)
and can accept the following parameters:
Key | Description |
---|---|
FSOUT |
The desired output frequency (must be positive and integer) |
FILTER |
The filter to apply in the resampling process |
Here we will resample a sequence of random data from the original sampling rate of 1 Hz to an output sampling rate of 50 Hz.
pl = plist('name', 'None', 'tsfcn', 'randn(size(t))', 'nsecs', 100, 'fs', 1, 'yunits', 'm'); x = ao(pl) pl_re = plist('fsout', 50); x_re = resample(x, pl_re); % resample the input AO (x) to obtain the resampled output AO (y) iplot(x, x_re, plist('XRanges', [10 20], ... 'Markers', {'o', '.'}, ... 'LineStyles', {'-', 'none'})) % plot original and resampled data
Upsampling a time-series AO | Interpolation of a time-series AO |
©LTP Team