Analysis of the refractive index profile and losses in ion-exchanged waveguides