Sliding Window Method for Simulating Action Potentials in Axons