| Prev | Next | resample |
| Syntax |
y = resample(x, Nup, Ndown) |
| Include: |
include spt\resample.oms |
| See Also | expand , interpfft |
ARGUMENTS:
INPUTS:
x = MATRIX, any numerical type.
Nup = SCALAR, any numerical type, interpolation factor.
Input data is interpolated to Nup times as many
input samples. Coerced to INTEGER before internal
processing.
Ndown = SCALAR, any numerical type, decimation factor.
Every Ndown-th sample of the interpolated data is
returned. Coerced to INTEGER before internal
processing.
RETURN: MATRIX, Column-wise resampled version of input.
Resample input data x by interpolating UP to Nup
times the input number of samples, then, decimating down by a
factor of Ndown.
Each column of an input matrix 'x' is resampled by first
interpolating up by factor Nup, then decimating down by
factor Ndown. Interpolation is done by the SPT function
'interpfft()' which uses a fourier transform method that
assumes the data is cyclic. Decimation is done simply
choosing every Ndown'th element of the interpolated column.
This function simulates resampling a signal to the rational
sampling rate Nup/Ndown. Output return length is a function
of choice of Nup and Ndown.
Nup and Ndown are coerced to INTEGER before local processing.
Nup and Ndown must each be >= 1 or 'novalue' is returned. If
both are equal to 1 the original input is returned.
Data input may be of any numerical type. Return type is
always type DOUBLE. Data input is coerced to DOUBLE before
local processing. Row dimension of data input must be at
least 2 except for the special case a row vector input which
is treated as a column vector with a row vector return.
# Interpolate a Squarewave
Nup = 5
Ndown = 3
a = fill( 1, Nin/4, 1)
b = fill(-1, Nin/4, 1)
x = { a, b, a, b } # Test signal
y = resample(x, Nup, Ndown)
Plotting both input and output: