You sholud start to learn Simulink which is part of Matlab. I think that there is an example in Simulink help for simillar topic.
Transfer function you have to develop according to control systems theory after that you will be able to complete your Simulink model.
Regards.