On an inverse problem for inhomogeneous thermoelastic rod