Solving Dynamics Problems in Matlab