adding a potential ftom a matrix