Solitary waves in an inhomogeneous rod composed of a general hyperelastic material