I just noticed that there is no much matlab codes/excercises happening in this forum.
Well as a start, I developed a small library of m functions to be used in robotics to compute forward dynamics(can be found here :
http://www.mathworks.fr/matlabcentral/fileexchange/31170-simple-forward-kinematics-library-for-robotic-chains). And another library for the dynamics simulation of kinematic chains ( can be found here:
http://www.mathworks.fr/matlabcentral/fileexchange/32638)
I used these libraries to simulate double inverted pendulum and demonstrate chaos theory. More info can be found in my blog depotbassam
http://depotbassam.blogspot.com/2011/08/chaos-theory-simulating-double-pendulum.html