New algorithm could help enable next-generation deep brain stimulation devices