Electron excitation spectra in Ti and Zr transition metals are calculated in the framework of time-dependent density functional theory. Several peaks found in the obtained loss functions are interpreted as collective excitations. The energy positions of the dominating bulk plasmons are in close agreement with the energy loss experiments. We investigated how the absorption of hydrogen modifies the dielectric properties of these materials. It is shown that the main plasmon energy blueshifts in a such process, again in agreement with experimental observations. On base of the calculated bulk dielectric functions of all these systems, we performed analysis of the excitation spectra at surfaces and nanoparticles. Several plasmon peaks in these systems with rather short lifetimes are found at reduced energies. It is shown how the nanoparticle excitation spectra are modified in the ultraviolet-frequency range upon hydrogen absorption.