We have recently uploaded to arXiv a paper on Lock in Feedback for sequential experiments. Here is the abstract:

*“We often encounter situations in which an experimenter wants to find, by sequential experimentation, $x_{max} = \arg\max_{x} f(x)$, where $f(x)$ is a (possibly unknown) function of a well controllable variable $x$. Taking inspiration from physics and engineering, we have designed a new method to address this problem. In this paper, we first introduce the method in continuous time, and then present two algorithms for use in sequential experiments. Through a series of simulation studies, we show that the method is effective for finding maxima of unknown functions by experimentation, even when the maximum of the functions drifts or when the signal to noise ratio is low.”*

The paper presents a novel solution for the above problem. Here is a simple [R] function to makes this work (ugly using the for loop, but this is closest to the representation in the paper):

lif.2 <- function(x0, A, T, gamma, FUN, TT, sigma=0, plot=FALSE, ...){
# Logging:
xy <- matrix(NA, nrow=TT, ncol=3)
# params:
yws <- rep(NA, T)
w <- (2*pi)/T
# the loop:
for(t in 1:TT){
xt <- x0 + A*cos(w*t)
yt <- FUN(xt, sigma=sigma)
yws <- push(yws, yt * cos(w*t))
if(t > T){
yw <- sum(yws) / T
x0 <- x0 + (gamma / T) * yw
}
xy[t,] <- c(xt, x0, yt)
}
# A plot of x0 if needed
if(plot){
plot(xy[,2], type="l", ...)
}
# Return the data
return(xy)
}

For the paper see: http://arxiv.org/pdf/1502.00598.pdf