Correlation between optical and electrical properties of materials containing nanoparticles