I need to derive Fourier time series coefficients associated to (i-1)^th harmonic from fft() function in R, some idea?
For instance Adding these concepts we get the general form of the Fourier Series:
f(t)=a_0+∑_k a_k×sin(kwt+ρ_k)
where a_0 is the DC component, w=2πf_0, where f_0 is the fundamental frequency of the original wave.
Each wave component a_k×sin(kwt+ρ_k) is also called a harmonic.
If I fixed the number of harmonics to 2, I would like to derive a_0,a_1,a_2 from fft()