| Prev | Next | interpfft |
| Syntax |
y = interpfft(x, N) |
| Include: |
include spt\interpfft.oms |
| See Also | expand , resample |
ARGUMENTS:
INPUTS:
x = MATRIX, any numerical type. Input data to be interpolated.
N = SCALAR, any numerical type, coerced to INTEGER before local
processing. Requested output row dimension.
RETURN: MATRIX, DOUBLE, column-wise interpolated data.
Interpolates an input from it's current length to length N by DFT method.
Each column of an input matrix is interpolated to a new
length N. N is coerced to INTEGER before local processing.
The requested output length must be at least 2, and, >= the
input row dimension or 'novalue' is returned. The input
matrix must have a row dimension of at least 2 except for the
case of a row vector which is treated as a column vector with
a row vector returned. All input is converted to DOUBLE
before local processing except for the case where the
requested row dimension is identical to the input row
dimension for which the original data is returned
unprocessed. (The imaginary part of COMPLEX input may be
interpolated by the call interpfft(1i0*x,N) or
interpfft(im(x),N)). Output type is always DOUBLE.
Both the input matrix 'x' and the return value are specified
on a uniform grid in the independent variable (the
interpolation is with respect to the independent variable).
If the rowdim of input matrix is ODD, a dft(or FFT if
power-of-2) is taken and zeros are appended to the middle of
the spectrum to extend the length to the requested length.
The ifft(or IFFT) is then taken and the result is scaled by
the ratio of the requested rowdim to the input rowdim.
If rdim(x) is EVEN and the requested length is EVEN, then
split the input spectrum into elements 1 through (N/2+1),
and, (N/2+1) through N. This increases length by 1. Add zeros
of length Nout-Nin-1 in between. Inverse transform.
# Make a Squarewave
Nin = 16; # Input length
Nout = 50; # Output length
a = fill( 1, Nin/4, 1) # High Level = +1
b = fill(-1, Nin/4, 1) # Low Level = -1
x = { a, b, a, b } # Squarewave
y = interpfft(x, Nout) # Interpolate
Plotting both input and output: