Waypoint trajectory matlab