Variable cross-section rods are used in many parts and mechanisms. For example, conical rods are widely used in percussion mechanisms. The strength of such parts directly depends on the natural frequencies of vibrations. Oscillations and vibration are also used in diagnostics, for example in acoustic diagnostics of defects. The paper presents a method that allows numerically finding a variable cross section of an elastic rod from the natural frequencies of longitudinal vibrations. It is assumed that the cross-sectional area varies along the axis and is described by an exponential function of a polynomial of degree n. The boundary condition on the left end is hard, on the right-elastic. It is shown that to determine n unknown coefficients of the cross section function, n natural frequencies are required.