Variational method for studying self-focusing in a class of nonlinear Schrödinger equations