Temperature dependence of optical excitations in MBa2Cu3O6 (M = Y,Sm)