MATLAB: Fourier Series Coefficients

fftfourier series

Good Afternoon All,
I want to calculate the fourier series coefficients of a discrete set of data (ao ak and bk). The problem is that I do not have enough data points to use the fft as I originally planned. Does anyone have any idea on how to calculate the coefficients without using the fft?
Thanks
Mel

Best Answer

fft does not require a specific number of samples to work. Equivalently, it works because fft pads zeros to your sample.
If you don't want to use fft, use the definition of Fourier transform to get the coefficients. For example, a0 = mean(data), ak=mean(data*sin(2*pi/n*k)), etc.
Related Question