David: Note that your problem is linear so it looks like you can use the lm
function to estimate a, b and c. ( or as a check against what john
did ) Unless I'm missing something which could be the case ! Also, see
Bloomfield's text for a closed form solution. I think it's
called "Intro To Four
Dear David,
I'm afraid that this doesn't make much sense -- that is, I expect that
you're not doing what you intended.
First, sin(2*pi*t) and cos(2*pi*t) are each invariant:
> sin(2*pi*t)
[1] -2.449294e-16 -4.898587e-16 -7.347881e-16 -9.797174e-16
-1.224647e-15 -1.469576e-15
[7] -1.714506e
Use nlsr::nlxb() to get analytic derivatives. Though your problem is pretty
rubbishy --
look at the singular values. (You'll need to learn some details of nlxb()
results to
interpret.)
Note to change the x to t in the formula.
JN
> f1 <- y ~ a+b*sin(2*pi*t)+c*cos(2*pi*t)
> res1 <- nls(f1, dat
I'm trying to fit a harmonic equation to my data, but when I'm applying the
nls function, R gives me the following error:
Error in nlsModel(formula, mf, start, wts) : singular gradient matrix at
initial parameter estimates.
All posts I've seen, related to this error, are of exponential function
4 matches
Mail list logo