calculate hysteresis method 1 find maximum difference