  We present a quantum algorithm that provides a general approach for obtaining
the energy spectrum of a physical system without making a guess on its
eigenstates. In this algorithm, a probe qubit is coupled to a quantum register
$R$ which consists of one ancilla qubit and a $n$-qubit register that
represents the system. $R$ is prepared in a general reference state, and a
general excitation operator acts on $R$ is constructed. The probe exhibits a
dynamical response only when it is resonant with a transition from the
reference state to an excited state of $R$ which contains the eigenstates of
the system. By varying the probe's frequency, the energy spectrum and the
eigenstates of the system can be obtained.
