GeneralModel(SoilR)
GeneralModel()所属R语言包:SoilR
The most general costructor for class Model
最普遍的类模型costructor
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function creates a numerical model for n arbitrarily connected pools. It is one of the constructors of class Model
该函数创建了一个数学模型为n任意连接池。它是一个类模型的构造
用法----------Usage----------
参数----------Arguments----------
参数:t
A vector containing the points in time where the solution is sought.
一种向量,包含的点的时间寻求溶液。
参数:A
A TimeMap object consisting of a matrix valued function describing the whole model decay rates for the n pools, connection and feedback coefficients as functions of time and a time range for which this function is valid. The size of the quadtratic matric must be equal to the number of pools. The time range must cover the times given in the first argument.
一个TimeMap对象组成的矩阵值函数描述的N池,连接和反馈系数为时间的函数,此功能有效的时间范围为整个模型的衰减率。的大小必须的quadtratic基质池的数量相等。必须涵盖的时间范围内的第一个参数的时间。
参数:ivList
A vector containing the initial amount of carbon for the n pools. The length of this vector is equal to the number of pools and thus equal to the length of k. This is checked by the function correctnessOfModel.
一个向量,包含初始的碳量为N池。该矢量的长度等于池的数量,从而等于k的长度。这是检查的功能correctnessOfModel。
参数:inputFluxes
A TimeMap object consisting of a vector valued function describing the inputs to the pools as funtions of time TimeMap.new.
一个TimeMap对象组成的一个向量函数的输入池funtions的时间TimeMap.new。
参数:solverfunc
The function used by to actually solve the ODE system. This can be SoilR.euler or deSolve.lsoda.wrapper or any other user provided function with the same interface.
使用真正解决ODE系统的功能。这可能是SoilR.euler或deSolve.lsoda.wrapper或任何其他用户提供的函数具有相同的接口。
参数:pass
Forces the constructor to create the model even if it is invalid
强制构造函数来创建的模型,即使它是无效的
值----------Value----------
A model object that can be further queried.
模型对象,可以进一步查询。
(作者)----------Author(s)----------
Carlos A. Sierra <csierra@bgc-jena.mpg.de>, Markus Mueller <mamueller@bgc-jena.mpg.de>
参见----------See Also----------
TwopParallelModel
TwopParallelModel
实例----------Examples----------
t_start=0
t_end=10
tn=50
timestep=(t_end-t_start)/tn
t=seq(t_start,t_end,timestep)
n=3
At=new("TimeMap",
t_start,
t_end,
function(t0){
#matrix(nrow=n,ncol=n,byrow=TRUE,[矩阵(NROW NCOL = N,N,byrow = TRUE,]
# c(-0.2, 0, 0, [。(-0.2,0,0,]
# 0.1, -0.7, 0, [0.1,-0.7,0,]
# 0, 1/2, -0.5)[1/2,0,-0.5)]
#)[)]
matrix(nrow=n,ncol=n,byrow=TRUE,
c(-0.2, 0, 0,
0 , -0.3, 0,
0, 0, -0.4)
)
}
)
c0=c(0.5, 0.5, 0.5)
#constant inputrate[不变inputrate]
inputFluxes=TimeMap.new(
t_start,
t_end,
function(t0){matrix(nrow=n,ncol=1,c(0.0,0,0))}
)
mod=GeneralModel(t,At,c0,inputFluxes)
Y=getC(mod)
lt1=1; lt2=2; lt3=3
col1=1; col2=2; col3=3
plot(t,Y[,1],type="l",lty=lt1,col=col1,
ylab="C stocks (arbitrary units)",xlab="Time")
lines(t,Y[,2],type="l",lty=lt2,col=col2)
lines(t,Y[,3],type="l",lty=lt3,col=col3)
legend(
"topright",
c("C in pool 1",
"C in pool 2",
"C in pool 3"
),
lty=c(lt1,lt2,lt3),
col=c(col1,col2,col3)
)
#now compute the accumulated release[现在计算累积释放]
Y=getAccumulatedRelease(mod)
plot(t,Y[,1],type="l",lty=lt1,col=col1,ylab="C Release (arbitrary units)",xlab="Time")
lines(t,Y[,2],lt2,type="l",lty=lt2,col=col2)
lines(t,Y[,3],type="l",lty=lt3,col=col3)
legend("topleft",c("R1","R2","R3"),lty=c(lt1,lt2,lt3),col=c(col1,col2,col3))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|