Impedance spectroscopy theory and applications