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 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 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.