File Exchange

image thumbnail


version (228 KB) by Qun HAN
Faster version of the MATLAB function bvp4c.

1 Download

Updated 07 Jun 2009

View License

The most time consuming part of BVP4C is the function colloc_Jac, especially when the number of equations is large. In bvp4c2 the inefficient sparse matrix operation in colloc_Jac is optimized according to the method intruduced in Loren's blog ( When called without unknown parameters and FJacobian is not used, bvp4c2 is more than 10x faster than BVP4C for large BVP systems.

The mex file SPARSE2.MEXW32 is compiled from SuiteSparse( It is about 2x faster than SPARSE. If you encounters problem with it, just comment it out in bvp4c2 and use the MATLAB function sparse.

Cite As

Qun HAN (2021). bvp4c2 (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Yadong He


Still ~2 times faster than the MATLAB original function for large problem.
Mathworks owe me a Thanks.

mincong he



You do not need this function after MATLAB R2014


MATLAB R2012 and higher versions do not need this code, because the bvp4c.m distributed with the software has already implemented such optimizaion.


Unzip to MATLABROOT\toolbox\matlab\funfun

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!