# NOT RUN {
# Calculate the logistic map.
cons <- 0.5
data.len <- 17000
chaos.start <- c(5536, 9768)
vec.x <- matrix(cons, data.len, 1)
vec.x[1] <- (2^0.5)/2
for (i in 2:data.len){
# x_n+1 = r*x_n(1-x_n)
vec.x[i] <- 3.7*vec.x[i-1]*(1-vec.x[i-1])
}
vec.x[1:(chaos.start[1]-1)] <-cons
vec.x[(chaos.start[2]+1):data.len] <-cons
tr1 <- seq(from = cons, to = vec.x[chaos.start[1]], length.out = 2001)
tr2 <- seq(from = vec.x[chaos.start[2]], to = cons, length.out = 2001)
vec.x[(chaos.start[1]-2000):chaos.start[1]] <- tr1
vec.x[chaos.start[2]:(chaos.start[2]+2000)] <- tr2
# Find regular intervals in vec.x and plot results.
regular_borders <- find_regularity(vec.x, "skip_window" = 1000,
"window_length" = 3000, "find_thresh" = 300)
# }
Run the code above in your browser using DataLab