1 | p.path.renew(pass.mat, cyc.mat, curr.time, x.curr, next.time, theta, dimen)
|
pass.mat |
|
cyc.mat |
|
curr.time |
|
x.curr |
|
next.time |
|
theta |
|
dimen |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (pass.mat, cyc.mat, curr.time, x.curr, next.time, theta,
dimen)
{
if (dimen > 1) {
x.next <- numeric(dimen)
for (i in 1:dimen) {
repeat {
x.next[i] <- eabesmid(next.time, curr.time, pass.mat[i,
"tau"], pass.mat[i, "tau"], x.curr[i], pass.mat[i,
"y"], pass.mat[i, "y"], pass.mat[i, "minI"])$w
if (eabesex(sV = c(curr.time, next.time), tV = c(next.time,
pass.mat[i, "tau"]), xV = c(x.curr[i], x.next[i]),
yV = c(x.next[i], pass.mat[i, "y"]), m = pass.mat[i,
"y"], B1 = x.curr[i] + pass.mat[i, "minI"] *
theta[i], B2 = x.curr[i] + pass.mat[i, "minI"] *
theta[i], minI = pass.mat[i, "minI"])$accI ==
1) {
break
}
}
}
p.taus <- p.path.init(s = next.time, x = x.next, theta = theta,
dimen = dimen)
pass.mat <- p.taus$pass.mat
cyc.mat <- p.taus$cyc.mat
list(curr.time = next.time, next.tau = cyc.mat[1, "tau"],
max.next = cyc.mat[1, "tau"] - next.time, pass.mat = pass.mat,
cyc.mat = cyc.mat, x.next = x.next)
}
else {
repeat {
x.next <- eabesmid(next.time, curr.time, pass.mat["tau"],
pass.mat["tau"], x.curr, pass.mat["y"], pass.mat["y"],
pass.mat["minI"])$w
if (eabesex(sV = c(curr.time, next.time), tV = c(next.time,
pass.mat["tau"]), xV = c(x.curr, x.next), yV = c(x.next,
pass.mat["y"]), m = pass.mat["y"], B1 = x.curr +
pass.mat["minI"] * theta, B2 = x.curr + pass.mat["minI"] *
theta, minI = pass.mat["minI"])$accI == 1) {
break
}
}
new.fpt <- bm.pass(s = next.time, x = x.next, theta = theta,
Jst.t = t.opt, Jst.rat = rat.opt)
pass.mat[] <- c(update.dimen, new.fpt$tau, new.fpt$y,
new.fpt$minI, x.next - theta, x.next + theta)
list(curr.time = next.time, next.tau = pass.mat["tau"],
max.next = pass.mat["tau"] - next.time, pass.mat = pass.mat,
cyc.mat = pass.mat, x.next = x.next)
}
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.