[R] regression with a*cos(angle+phi)+b

Markus Häge markus_haege at gmx.de
Mon Nov 30 13:19:46 CET 2009


Hello,

the only thing I found to fit a sin/cos is s.th like lm(a~cos+sin) But
this is not what I want.
I have a magnitude which is sinusoidal with offset and it doesn't start
at phi=0.

The data is:

angle<-c(0,10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180)

Voltage<-c(-45.07, -45.24, -43.61, -40.78, -36.48, -30.92, -23.83,
-15.95,  -7.53,   1.06,  11.24,19.85,  27.00,  35.00,  42.90,  49.41,
54.62,  58.54,  60.90)

I need an regression with Voltage=A*cos(angle+phi)+B.
How does this work? With lm or shall I use twice Fourier?

thanks

Markus




More information about the R-help mailing list