I'm doing the time-series data analysis using FFT. After fft(), I used
spectrum() to calculate the power spectrum, which is used to define the main
frequency. Now I want to get the phase information according to this frequency.
For example, input 12 time-point data,
>d<-c(1.2950487,0.8547907,0.5636902,0.3928039,0.4564737,0.2296953,-0.1319331,-0.3122781,-0.3773676,-0.5930794,-0.9185491,-1.3633293)
>fft(d)
[1] 0.09596575+0.0000000i 0.84111080-4.3717147i 1.20570677-2.0131148i
[4] 1.86094684-1.7742100i 1.39627707-0.8900564i 1.57888778-0.3601454i
[7] 1.67875966+0.0000000i 1.57888778+0.3601454i 1.39627707+0.8900564i
[10] 1.86094684+1.7742100i 1.20570677+2.0131148i
0.84111080+4.3717147i>spectrum(fft(d))$freq
[1] 0.08333333 0.16666667 0.25000000 0.33333333 0.41666667
0.50000000> spectrum(fft(d))$spec
[1] 0.9772920 1.6402597 0.8764470 0.6785063 0.9855313 0.7042088
here, if i used the g-test to define the main component is the second frequency.
I want to calculate the phase of it (Max Phase). Then which complex value in fft
output is used for the atan function ? The first and seventh values are real,
seems they are DC and Nyquist frequency.
Your help should do me a big favor.
Thanks,
Guang'an Hu
[[alternative HTML version deleted]]