A quaternion-based quadcopter model written in Matlab code