Displaying 1 result from an estimated 1 matches for "slval".
Did you mean:
s_val
2006 Feb 24
1
help with optimize statement
...9;m doing wrong here.
I have two equations, one a michalis-menton eqn and one a straight line.
I need to work out where they cross.
I created the function:
solveEqn<-function(x,vals){
Vmax<-vals[1]
Ks<-vals[2]
m<-vals[3]
c<-vals[4]
diff<-0
mmVal<-exp(Vmax+x/(Ks+x))
slVal<-x*m+c
diff<-mmVal-slVal
return(diff)
}
> optim(c(200,500),solveEqn,vals=c(2.4591201,-0.4015233,5.924e-5,3.437))
Error in optim(c(200, 500), solveEqn, vals = c(2.4591201, -0.4015233, :
objective function in optim evaluates to length 2 not 1
If i replace return(diff) wit...