Gradient-dependent plasticity in numerical simulation of localization phenomena