MOSFET as a variable resistor