|
@@ -1,5 +1,4 @@
|
|
|
print("START ANALYZING HEAD")
|
|
print("START ANALYZING HEAD")
|
|
|
-#color <- rainbow(length(STATE))
|
|
|
|
|
color <- c("red", "blue", "blue", "green")
|
|
color <- c("red", "blue", "blue", "green")
|
|
|
|
|
|
|
|
#Plot graph
|
|
#Plot graph
|
|
@@ -20,7 +19,7 @@ differ_ <- 0.1
|
|
|
f <- function(x) (sin((x - 5) / 2.7) / 30) + WALKBASE
|
|
f <- function(x) (sin((x - 5) / 2.7) / 30) + WALKBASE
|
|
|
|
|
|
|
|
# Draw Optimum walk
|
|
# Draw Optimum walk
|
|
|
-lines(WALKING, f(WALKING), col = "red", type = "l")
|
|
|
|
|
|
|
+lines(WALKING, f(WALKING), col = "orange", type = "l")
|
|
|
|
|
|
|
|
# Check if each point is close to optimum track
|
|
# Check if each point is close to optimum track
|
|
|
WALK <- data.frame(index=WALKING)
|
|
WALK <- data.frame(index=WALKING)
|
|
@@ -28,19 +27,10 @@ WALK$probability <- 0
|
|
|
|
|
|
|
|
for(i in WALKING){
|
|
for(i in WALKING){
|
|
|
prob_ <- 1 - abs((abs(DATA[i,]$Head.y - f(i))) / differ_)
|
|
prob_ <- 1 - abs((abs(DATA[i,]$Head.y - f(i))) / differ_)
|
|
|
- #print(DATA[i,]$Head.y)
|
|
|
|
|
- #print(f(i))
|
|
|
|
|
- #print(prob_)
|
|
|
|
|
- #print("======")
|
|
|
|
|
WALK[WALK$index==i,]$probability <- if(prob_ > 1) 1 else if(prob_ < 0) 0 else prob_
|
|
WALK[WALK$index==i,]$probability <- if(prob_ > 1) 1 else if(prob_ < 0) 0 else prob_
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-# points(WALK[WALK$probability == min(WALK$probability),]$index, 0.3)
|
|
|
|
|
-# points(WALK[WALK$probability == max(WALK$probability),]$index, 0.3)
|
|
|
|
|
-
|
|
|
|
|
# Print out possible fall chance
|
|
# Print out possible fall chance
|
|
|
print(paste("FALL CHANCE BASED ON STEPS: ", as.character(specify_decimal(100-(mean(WALK$probability)*100), 2)), "%", sep = ""))
|
|
print(paste("FALL CHANCE BASED ON STEPS: ", as.character(specify_decimal(100-(mean(WALK$probability)*100), 2)), "%", sep = ""))
|
|
|
|
|
|
|
|
print("DONE ANALYZING HEAD")
|
|
print("DONE ANALYZING HEAD")
|
|
|
-# http://stats.stackexchange.com/questions/30975/how-to-add-non-linear-trend-line-to-a-scatter-plot-in-r
|
|
|
|
|
-# http://www.mathsisfun.com/geometry/parabola.html
|
|
|