when detection linear range, use average of y values with the same x value