search for: dfxy2

Displaying 1 result from an estimated 1 matches for "dfxy2".

Did you mean: dfxy
2012 Apr 24
1
Use of optim to fit two curves at the same time ?
...x[1] b <- x[2] xtest <- dfxy[,1] yobs <- dfxy[,2] ysim <- a*xtest + b sum((ysim - yobs)^2) } out<- optim(par=c(0.2,5), fn=function(x){optfunc(x, dfxy)}, method = "Nelder-Mead", hessian = F) ## function 2 x2 <- seq(0.01, 0.1, length=100) y2 <- exp(30*x2) dfxy2 <- cbind(x2,y2) # objective function optfunc2 <- function(x, dfxy){ a <- x[1] xtest <- dfxy[,1] yobs <- dfxy[,2] ysim <- exp(a*xtest) sum((ysim - yobs)^2) } out<- optimize(f=function(x){optfunc2(x, dfxy2)}, interval=c(0,500)) #######################################...