Measuring resistance by measuring both voltage and current