Generation and coherent detection of terahertz radiation by photomixing: dielectric media characterization