sim ./bin/rd1.m computes the impedance assuming that the unknown impedance is in series with a resistor Rref (this value is stored in rd1.m). One channel is connected to the top of the load, and one to the bottom of the unknown load impedance, which in turn is connected to Rref = 1k Ohm For this to work well, one needs to buffer the voltages with an opamp, to remove the leakage currents. A good choice is one with a very high input impedance (1GOhm) (Jfet input op-amp). Then the load impedance is given by (Vx-Vref)/Iref where Iref=Vref/Rref. Thus: Zx = Rref * (Vx/Vref -1 )