Displaying 3 results from an estimated 3 matches for "jfit".
Did you mean:
fit
2017 Jun 21
1
fitting cosine curve
...0,omega=.04), trace=TRUE)
co <- coef(fullFit)
fit <- function(x, a, b, c, d) {a*cos(b*x+c)+d}
plot(x=t, y=y)
curve(fit(x, a=co['A'], b=co['omega'], c=co['C'],d=co['B']), add=TRUE
,lwd=2, col="steelblue")
jstart <- list(A=20, B=100, C=0, omega=0.01)
jfit <- nlxb(y ~ A*cos(omega*t+C) + B, data=lidata,
start=jstart, trace=TRUE)
co <- coef(jfit)
fit <- function(x, a, b, c, d) {a*cos(b*x+c)+d}
plot(x=t, y=y)
curve(fit(x, a=co['A'], b=co['omega'], c=co['C'],d=co['B']), add=TRUE
,lwd=2, col="s...
2017 Jun 21
1
fitting cosine curve
If you know the period and want to fit phase and amplitude, this is
equivalent to fitting a * sin + b * cos
> >>> > I don't know how to set the approximate starting values.
I'm not sure what you meant by that, but I suspect it's related to
phase and amplitude.
> >>> > Besides, does the method work for sine curve as well?
sin is the same as cos with
2017 Jun 21
0
fitting cosine curve
I'm trying the different parameters, but don't know what the error is:
Error in nlsModel(formula, mf, start, wts) :
singular gradient matrix at initial parameter estimates
Thanks for any suggestions.
On Tue, Jun 20, 2017 at 7:37 PM, Don Cohen <don-r-help at isis.cs3-inc.com>
wrote:
>
> If you know the period and want to fit phase and amplitude, this is
> equivalent to