phase angle of harmonic I have generated sinsuoids containing fundamental with harmonics using C++. Fundamental frequency is 50 Hz and each of the harmonic has phase offset of 60 degrees. I have applied flattop window before performing and N point FFT. Magnitude repose is correct. Phase reponse is wrong. I should expect 60 degree in all 100,150,200,250 Hz.
I have attached the results.

Sampling rate : 40000
Timeduration : 1s
Maximim amplitude of each of the harmonic : 1

Any help would be highly appreciated.




Regards,
Faisal
Your window is centered around the middle of the time window. This corresponds (roughly speaking) to a delay of half the window size and corresponding additional phase of $e^{-j \cdot \omega \cdot t}$

The "wiggles" that you see is a steep linear phase that wraps around 2*pi occasionally. There a few ways to fix this.


circularly shift the time domain signal so that the max of the window is at 0. This will be better but still isn't great since the windowing will significantly impact the phase. 
Make sure that the fundamental fits into your time window and integer amount of times. Then do an FFT without windowing. This should give you an exact result.