# Is it possible to use FFT to derive a Fourier series fitting to data?

I want to do something like what is done in this question about fitting , ie find a Fourier series that approximates a continuous but complicated function. However I want to know whether it is possible to use the FFT for it.

Now to be precise my function is the ecliptic longitude of a celestial body. This function isn't periodic in the sense that it has an overall trend (the longitude keeps increasing overall) but I figure it is possible to factor out the straight line trend as suggested in this USNA page and use the Fourier series just to cover the minor variations from it.

Now I am not formally trained in college-level mathematics (I'm formally in the humanities) but I have been reading around. Especially on this site I have read this question asking for the difference between Fourier series and transform and this one about how to use a transform to find the series and understand the contents to a certain extent.

Now the USNA page doesn't say exactly how to derive the Fourier series. I don't have access to MatLab to just do fit(t',Y,'fourier8') as suggested in the first-mentioned question. However I am seeing many OSS libraries which have the FFT. Is it possible to derive a Fourier series using such an FFT? How?

The last-mentioned question seems to provide a method but the mathematical notation is higher than my comprehension limit so I'd appreciate simpler instructions.