各位巨巨们好,刚接触R语言,下面的代码看的不是很懂,就看懂了前面一段,后面的4段看不懂,请大家帮忙看看,解释下,不胜感激。=。-
# Here is the program that would do the optimisation of ap = f(c) to retrieve
# a*_1, a*_2 and S.
f <- function(as1=as1,as2=as2,Sf=Sf,chl=chl)
{(as1-as2)/Sf*(1.-exp(-Sf*chl))+as2*chl }
res <- nls(y ~ f(as1,as2,S,chl=chl),start=list(as1=0.1,as2=0.05,S=3.))
Sf = as.numeric(coefficients(res)[3])
astar1=as.numeric(coefficients(res)[1])
astar2=as.numeric(coefficients(res)[2])
|