An experimental and theoretical study of the formation and microstructure of porous silicon