Navigation

Operators and Keywords

Function List:

C++ API

: interpft (x, n)
: interpft (x, n, dim)

Fourier interpolation.

If x is a vector then x is resampled with n points. The data in x is assumed to be equispaced. If x is a matrix or an N-dimensional array, the interpolation is performed on each column of x.

If dim is specified, then interpolate along the dimension dim.

interpft assumes that the interpolated function is periodic, and so assumptions are made about the endpoints of the interpolation.

See also: interp1.

Demonstration 1

The following code

 clf;
 t = 0 : 0.3 : pi;  dt = t(2)-t(1);
 n = length (t);  k = 100;
 ti = t(1) + [0 : k-1]*dt*n/k;
 y = sin (4*t + 0.3) .* cos (3*t - 0.1);
 yp = sin (4*ti + 0.3) .* cos (3*ti - 0.1);
 plot (ti, yp, 'g', ti, interp1(t, y, ti, "spline"), 'b', ...
       ti, interpft (y, k), 'c', t, y, "r+");
 legend ("sin(4t+0.3)cos(3t-0.1)", "spline", "interpft", "data");

Produces the following figure

Figure 1

Package: octave