Dynamic stability of elastic structures: a finite element approach