I am sorry for the previous email.

I am getting such error while fitting in it.

Am i missing something big in it ?

Please guide me.

Thanks a lot

rm(list=ls())

>V=10000 ;ke=0.5

 t=c(0.00,0.20,0.50,1.00,2.00,4.00,6.00,8.00,12.00,18.00,24.00,30.00)

 A=identitty matrix of 6*6   ## Constraint Matrix

 B=c(0.1,0.1,0.1,0.1,1,9)    ## Constraints Vector

>theta0=c(0.1859271,0.3055791,0.906867,0.3197446,4.0210769,12.119009)
#(Initial Para)



>Cp.Expt=c(0.00000,0.00000007464,0.00000040420,0.00000128074,0.00000328526,0.00000587388,

+
0.00000653098,0.00000623716,0.00000484488,0.00000277593,0.00000125929,0.00000034722)

> f=function (t,theta) {

   ( (theta[1]*theta[3]*(exp(-theta[3]*(t-theta[5]))))
/(1+exp(-theta[3]*(t-theta[5])))^2 ) +

     ( (theta[2]*theta[4]*(exp(-theta[4]*(t-theta[6]))))
/(1+exp(-theta[4]*(t-theta[6])))^2 )}

> Cp.fit=function(t,theta){

     times= seq(from=0,to=36,by=0.01)

     y0=c(0)

     It=c(0,0,0)

     model = function(t, y,It) {

         It[1]=f(t,theta)

         dy1= It[1]/V-ke*y[1]

         list(c(dy1),It=It[1]) }

     #out = ode(y0, times, model)

     out=ode(y0,times,model,parms=NULL,method=rkMethod("rk4"))

     out=data.frame(out)

     Cp.fit=out[out$time %in% t,2]

     #It.fit=out[out$time %in% t,3]

     return(Cp.fit)}

> residual2=function (theta,t,Cp.Expt){sum((Cp.Expt-Cp.fit(t,theta))^2)}



> library(deSolve)



> constrOptim(theta0,residual2,t=t,Cp.Expt=Cp.Expt,NULL,A,B)

Error in ui %*% theta : requires numeric/complex matrix/vector arguments





-
mj

	[[alternative HTML version deleted]]

