using a resistor matrix