Skip to main content
. 2014 Oct 10;14(10):18800–18822. doi: 10.3390/s141018800
function num_errors = costfunction(gyr_thresh, angle_thresh)
{
num_errors = 0;
 for all trials in database
  detected_time = turn_detection_algorithm(IMU_signals, gyr_thresh, angle_thresh);
  if trial contains turn
   if turn was detected
    if abs(detected_timereference_time) > 500 ms num_errors = num_errors + 1;
    end
   else
    num_errors = num_errors + 1;
   end
  else
   if turn was detected
    num_errors = num_errors + 1;
   end
  end
 end
}