matlab alcove code