我在R中相当新,我试图绘制一个微分方程,并且在同一个图中我必须在4次左右这样做。我试过以下方式
m = sum(C[])
s= 4 #number of time curve in single plot
for(i in 1:length(s)){
b = 0.1;X = sample(c(-1,1), replace=T,1); sig = runif(0.01, min= 0.001, max = 0.01);yini <- 1
derivs <- function(t,y, parms)
list(tanh(b*m)- X + sig) #dx/dt = tanh(b*m)- X + sig (differential equation)
times <- seq(from = 0, to = 10, by = 0.5)
library(deSolve)
out <- ode(y = yini, times = times, func = derivs, parms = NULL)
}
head(out)
plot(out, main = "logistic growth", lwd = 2)
我收到了以下错误 checkFunc出错(Func2,次,y,rho): 由func()(0)返回的导数的数量必须等于初始条件向量(1)的长度