Phase-matched second-harmonic generation due to anomalous dispersion: tailoring of the refractive indices in three-component systems