投与間隔を半分にしてみる。
time_interval <- seq(0, 1, by=0.05) #投与間隔 nt <- 0.5 #間隔の変更 blood_conc <- y0 max_conc <- 1 #愚直に計算する for(i in 1:(N - 1)){ blood_conc <- append(blood_conc, y(time_interval, tail(blood_conc, 1))) blood_conc[length(blood_conc)] <- tail(blood_conc, 1) + y0 max_conc <- append(max_conc, which(blood_conc==max(blood_conc))) } plot(blood_conc, ylim=c(0, max(blood_conc)), type="l", xlab="time", ylab="concentration") lines(max_conc, blood_conc[max_conc], lty=2, col=2) #最終的に到達する濃度 time_interval <- seq(0, nt, by=0.05) #投与間隔 for(i in 1:(N - 1)){ blood_conc <- append(blood_conc, y(time_interval, tail(blood_conc, 1))) blood_conc[length(blood_conc)] <- tail(blood_conc, 1) + y0 max_conc <- append(max_conc, which(blood_conc==max(blood_conc))) } plot(blood_conc, ylim=c(0, max(blood_conc)), type="l", xlab="time", ylab="concentration") lines(max_conc, blood_conc[max_conc], lty=2, col=2) #最終的に到達する濃度