You are on the right track to a possible solution. Instead of connecting a torque sensor to the joint and feeding back the opposite, use a position sensor and calculate the appropriate torque. There is an example of doing this with a prismatic joint here:
http://www.mathworks.com/support/solutions/en/data/1-BWX80W/index.html
This can easily be modified for a rotational joint.
To make sure that it runs reasonably well, pick a fairly large damping coefficient, and be sure to use a stiff solver! The solver can be set though the model's Configuration Parameters. I would suggest ode15s or ode23t for a model like this.