[R] Question on harmonic (Fourier) analysis of sinusoidal time series

holden999 ing.graziani at gmail.com
Mon Apr 9 11:27:42 CEST 2012


Hello,

I will try to explain the problem, sorry if  it will be a little long...

I'm using R to analyze results of cyclic mechanical testing, like this:
- apply quasi-sinusoidal load
- measure quasi-sinusoidal vertical and horizontal deformations

(quasi-sinusoidal load means that load "should be" sinusoidal, but testing
machine puts in some noise...)
I enclose a sample of data at the end of this message.

I used harmonic regression to fit the data: 

force = constant + [1st order Fourier harmonic] + [2nd order Fourier
harmonic] + higher order harmonics...  + error =

= v0 + [a1 sin (2*pi*f*t) +  b1 cos (2*pi*f*t) ] + [a2 sin (2*2*pi*f*t) + 
b2 cos (2*2*pi*f*t)] + ... + error

where f is the frequency of the sinusoidal load applied during the test.

What I'm expecting to find is:
- v0 (average value)
- a1, b1 "high" values of coefficients of the first "fundamental" harmonic
that the machine is applying 
- an, bn  "low" values of coefficients of the higher  harmonics 
- some noise ~ NID

I used lm() to fit the linear model using the code suggested in
"Introductory Time Series with R"
by Paul S.P. Cowpertwait (2006 SPRINGER SCIENCE+BUSINESS MEDIA, LLC.).
Started with 1st harmonic component and then increased up to 6.

Here's the results (6 harmonic components, but results are similar with less
harmonics):

Call:
lm(formula = force.fit ~ s + c)

Residuals:
       Min         1Q     Median         3Q        Max 
-0.0147651 -0.0052199 -0.0005713  0.0052815  0.0185080 

Coefficients:
              Estimate Std. Error  t value Pr(>|t|)    
(Intercept) -1.3264070  0.0002227 -5957.00   <2e-16 ***
s1          -1.3083551  0.0003149 -4154.91   <2e-16 ***
s2          -0.0538174  0.0003149  -170.91   <2e-16 ***
s3          -0.0346178  0.0003149  -109.94   <2e-16 ***
s4          -0.0070427  0.0003149   -22.36   <2e-16 ***
s5          -0.0069028  0.0003149   -21.92   <2e-16 ***
s6           0.0155151  0.0003149    49.27   <2e-16 ***
c1           0.3746976  0.0003149  1189.92   <2e-16 ***
c2          -0.0149771  0.0003149   -47.56   <2e-16 ***
c3           0.0272273  0.0003149    86.47   <2e-16 ***
c4          -0.0282915  0.0003149   -89.84   <2e-16 ***
c5          -0.0084926  0.0003149   -26.97   <2e-16 ***
c6          -0.0093216  0.0003149   -29.60   <2e-16 ***

Fundamental harmonic is there: a1 =  -1.3083551, b1 =   0.3746976 and, as
expected, higher order harmonics have much smaller coefficients. BUT
residuals are PERIODIC:

http://r.789695.n4.nabble.com/file/n4542389/residualsplot.jpg 

Since my "error" doesn't look like noise ( is strongly autocorrelated) did I
make any mistakes?

Thank you for reading down to this line...
I hope you have suggestions!

Thanks
Andrea


###########################
Here's a sample of data:

> data[1:10,] 
     time  force    vdef   hdef
1  0.0000  0.000   0.000  0.000
2  0.0025 -0.007  -0.229  0.000
3  0.0050 -0.166  -1.829  0.453
4  0.0075 -0.544  -7.086  2.038
5  0.0100 -0.957 -13.714  3.849
6  0.0125 -1.304 -19.886  5.660
7  0.0150 -1.550 -25.143  7.245
8  0.0175 -1.719 -29.714  8.377
9  0.0200 -1.838 -33.372  9.510
10 0.0225 -1.933 -36.343 10.642

--
View this message in context: http://r.789695.n4.nabble.com/Question-on-harmonic-Fourier-analysis-of-sinusoidal-time-series-tp4542389p4542389.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list