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

2009-11-30 Thread Peter Dalgaard
Jorge Ivan Velez wrote: > Good morning Markus, > > Perhaps ?nls might be useful in this case. Or consult a compendium and realize that both formulas actually fit the same class of shifted sinusoidals... It holds that cos(v+phi) = cos phi cos v - sin phi sin v so you can fairly easily find A a

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

2009-11-30 Thread Jorge Ivan Velez
Good morning Markus, Perhaps ?nls might be useful in this case. HTH, Jorge On Mon, Nov 30, 2009 at 7:19 AM, Markus Häge <> wrote: > 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

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

2009-11-30 Thread Markus Häge
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