The spectra of relic gravitational waves produced as a result of cosmological expansion of the generalized inflationary models are derived. It is shown how one can reconstruct the time dependence of the very early Hubble parameter and matter energy density from a measured frequency-dependent spectrum of relic gravitational waves.