The effect of the refractive index profile on the optical response of plasmonic nanostructures inside semiconductors