This is octave script demonstrating impedance calculation using DFT. It was preparation for writing firmware. Impedance is calculated by dividing complex first harmonic (from DFT algorithm) of voltage by current (real and imaginary parts are calculated separately to avoid calculation on complex numbers on the microcontroller). It's also demonstrated that excitation needn't be sine - square wave is ok as only the first harmonic is considered.
