A novel approach for solving the equations describing the longitudinalvibration of functionally graded rods with viscous and elastic boundaryconditions is proposed. The characteristic equation of the system is derivedand a homotopy method is applied to compute the eigenvalues and mode shapesfor any type of boundary condition, including fixed, free, elastic and/orviscous. Examples are provided for different graded rods with elastic andviscous boundary conditions. The optimal damping of the system is computedbased on the spectral abscissa criterion. It is shown that the qualitativebehavior depends on whether the damping of the system exceeds the optimaldamping. The energy density distribution of the different graded rods is alsodiscussed. An energy measure, the mean scaled energy density distribution isintroduced to characterize the energy distribution along the rod in theasymptotic time limit. It is shown that the energy distribution alsoqualitatively depends on the relation between the actual damping and theoptimal damping of the system.