A method for the numerical solution of two-point boundary value problems for ordinary differential equations, using MATLAB, is discussed in this paper. A classical algorithm for this problem has been proposed by Kierzenka and Shampine [1]. This method, known as bvp4c, works under very general assumptions. It is based on collocation techniques, and, for its implementation, one needs to compute many derivatives of the given functions. The original algorithm calculated these derivatives by a purely numerical method (finite differences). It turns out, however, that bvp4c can be substantially improved with respect to robustness and speed if these numerical derivatives are replaced by analytical ones. Thus, this paper discusses how such analytical derivatives can be provided for use with bvp4c in an efficient way. The method of choice is automatic differentiation. The resulting algorithm is described in detail. Illustrative examples are given, and the effect of vectorization is explained.