interpft

Resamples a periodic signal using the Fourier transform.

Category: Mathematics > Interpolation

Syntax

y = interpft(x, n)

Returns n equally spaced samples of the periodic signal whose samples are x.

y = interpft(x, n, dim)

Resamples along dimension dim.

Description

The signal is transformed with the FFT, zero-padded (or truncated) in the frequency domain to length n, and transformed back. This is exact trigonometric interpolation for signals that are band-limited and periodic over the sampled interval.

When n is larger than the input length the result interpolates between the original points, which still appear in it; the output is scaled so amplitudes are preserved. Choosing n smaller than the input length decimates the signal, which discards high frequencies.

Input arguments

x
Vector or array of equally spaced samples over one period.
n
Number of output samples.
dim
Dimension to operate along. By default, the first non-singleton dimension.

Output arguments

y
Resampled signal with n points along the chosen dimension.

Example

Doubling the samples of one sine period

x = [0 1 0 -1];
y = interpft(x, 8);
disp(round(y*1000)/1000)
Output
         0    0.7070    1.0000    0.7070         0   -0.7070   -1.0000   -0.7070

See also

fft ifft interp1 resample