MATLAB: How to apply fourier transform to a cubic spline

fourierpiecewise-polynomialspline

Hi all,
I have some data that I can fit to a cubic spline interpolant in cftool. I now want to apply a fourier transformation to this fitted spline, which is represented as a piecewise polynomial in Matlab. Is there any way to do that? Note that I do not want to apply the fourier transformation directly on the original data, rather I want to apply it to the continuous function represented by the spline. I hope this makes sense.
Thanks, Sirisha

Best Answer

The FFT works numerically on actual arrays of numbers, not a list of cubic coefficients, which is essentially what a spline description is. So you need to interpolate the spline to fill in data points in between the knots. See my attached demo. Then call fft() on the dats.