How to get coefficients for sine/cosine function from complex FFT?

I'm working on a control system that measures the movement of a vibrating robot arm. Because there is some deadtime, I need to look into the future of the somewhat noisy signal. My idea was to use the frequencies in the sampled signal and produce a fourier function that could be used for extrapolation.

My question: I already have the FFT of the signal vector (containing 60-100 values e.g.) and can see the main frequencies in the amplitude spectrum. Now I want to have a function f(t) which fits to the signal, removes some noise, and can be used to predict the near future of the signal. How do I calculate the coefficients for the sine/cosine functions out of the complex FFT data?

This is a no brainer for anyone who's studied signal processing (Im wondering why its been so long since its been answered)

The Fourier Transform itself is a function that tells you what sinusoid do you need to add together to create this continuous signal. (Its like the Fourier series for more complex signals)

the FFT algorithm gives you COMPLEX coefficients (a+bj) (where j is the imaginary number... it looks like and i but backwards....)

calculate the magnitude of each coefficient A(n) = sqrt(a(n)^2 + b(n)^2) calculate the phase of each coefficient phi(n) = inverse_tan(b(n)/a(n)); (remember to use atan2 so that it results in the correct quadrant)

now remember based on your sampling rate each coeff represents a "bin" of frequencies, however you should think of them as evenly distributed frequencies:

So if you have N bins each frequency_bin they represent is f = Fs/(2*N)

then your signal becomes

$$f(x) = \Sigma^N_0 A(n)*cos(2*\pi*f(n) + \phi(n))$$

also: Predicting function: Impossible. that would be asking for a non-causal system.

• Two reasons why I didn't answer it- 1) it's old, don't know why Dipan resurrected it, and 2) FFT's are not how I would do function prediction. The OP is asking for the wrong thing. – Jim Clay Apr 17 '12 at 18:02