In the classical neural-gas method, the neurons are located in the input space according to the input density. But if we want to use this kind of approach as a function approximator, it can be interesting to change the spatial distribution of the neurons, so that they concentrate in regions where the unknown function appeared to be more complex. To achieve this goal, we modified the update rule of the neurons so that they move towards regions where the estimated local error is high. In this article, we first show how to estimate this error locally to each neuron, and then we detail the modification of the algorithm. Finally, we present some simulations results that allow us to compare the modified approach with the classical one.