I am fairly new in R I am trying to plot a differential equation and further in same plot I have to do this around 4 time. I have tried following way
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)
I am getting following error Error in checkFunc(Func2, times, y, rho) : The number of derivatives returned by func() (0) must equal the length of the initial conditions vector (1)