This tutorial shows how to formulate, solve, and plot the solutions of boundary value problems (BVPs) for ordinary differential equations.
The tutorial introduces the function BVP4C (available in MATLAB 6.0 and later), briefly describes the numerical method used, and illustrates solving BVPs with several examples and exercises.
The Mfiles for all the examples and exercises in the tutorial are available in the directory BVP_examples.
The directory BVP_examples_65 contains the files for the examples and exercises, updated to take advantage of features available in MATLAB 6.5 (R13).
Correspondingly, BVP_examples_70 contains files modified for use with MATLAB 7.0 (R14).
More information about solving BVPs in MATLAB, can be found in the paper
Jacek Kierzenka, Lawrence F. Shampine,
A BVP Solver based on Residual Control and the MATLAB PSE,
ACM TOMS, Vol. 27 (2001), No. 3, pp. 299316.
or in the book
L.F. Shampine, I. Gladwell, and S. Thompson,
Solving ODEs with MATLAB, Cambridge University Press, 2003.
Jacek Kierzenka (2020). Tutorial on solving BVPs with BVP4C (https://www.mathworks.com/matlabcentral/fileexchange/3819tutorialonsolvingbvpswithbvp4c), MATLAB Central File Exchange. Retrieved .
1.2.0.1  Updated license 

1.2.0.0  Copyright update 

1.1.0.0  Copyright update 

1.0.0.0  Updated to MATLAB 7.0 (R14) 
Create scripts with code, output, and formatted text in a single executable document.
Thank you, this tutorial is very useful.
Thanks
I have an example for using bvp4c
consider we will solve a bvp problem like this
y"+y'=x
y(0)=1
y(1)=4
Matlab code:
dydt=@(x,y)[y(2); 6*y(2)+x];
bc=@(ya,yb)[ya(1)+1; yb(1)4];
yinit=@(x)[exp(x); exp(x)];
solinit=bvpinit(linspace(0,1,20),yinit);
sol=bvp4c(dydt,bc,solinit);
% "sol" callback you three part:x,y,y'
plot(sol.x,sol.y(1,:))
These tutorials are excellent, but I still need help in solving a system of coupled differential equations using bvp4c.Ref. (ex8bvp)
(1+N)f'''f'^2+ff''NLf''^2f'''R(1+N)f'+(RNL/3)f''^2f'+g+Kh=0
g''+P(2fg'f'g)+Kh''=0
h''+c(2fh'f'h)+Sg''=0
with
f(0)=0, f'(0)=0,g(0)=1,h(0)=1,f'(infinity)=0,g(infinity)=0, h(infinity)=0
Could anyone help me solve this problem:
Equation : d2y/dx2 + y = f(x)
Restrains: y(a) = m; y(b) = n.
Thank you so much for your help.
How do I actually watch this file? Website is taking me in circles.
Why in the example 8 they can have more boundary conditions than equations?. I want to do something similar; solve a system of two equations with 4 boundary conditions, but matlab only let me put 2 boundary conditions.
There is a bug in example 4, which cause it to not follow the boundary values,
the correct res. function should be:
res = [ ya(1)
yb(1)
(ya(2)yb(2)) ];
which is not dependent on T, instead of
res = [ya(1)  yb(1)
ya(2)  yb(2)
T*(1/3)*(ya(1)  0.7 + 0.8*ya(2))  1];
Its good for beginners
I can't understand how can I chose the right guess... and for examples the two guesses in example 1. Can somebody help me?
I was wondering to solve:
y1'=A1*y2'+B1*y3+C1*y4
y2'=A2*y1'+B2*y3+C2*y4
y'3=0
y'4=0
but I could not use the tutorial,
downloading problem
bvp4c is really helpful in bvps. I have a question,
to solve a bvp like
d^y/dx^2 + y=0 where y and x are both vectors how can I modify the code?
helpful, thx
with ode45 solving initial value problems I have no problem,but to use bvp4c I have some problem,most of time I receive the message,
??? Error using ==> bvp4c
Unable to solve the collocation equations 
a singular Jacobian encountered.I try to change initial guess but I'm reiceving the same message.bvp4c need to be improved in order to help user strigling to solve twopoint boundary value problems.
Hello, I want to solve 24 diffrential equations in matlab using BVP4C but it says singular jacobian . could you please help me
Excsellent
Excellent
Poor
Needs Improvement
You strongly help me to solve my numerical problem
I hope people with basic knowledge of pure mathematics will find it quite useful.
Its a very good tool fou boundary value problem. One can learn a lot of from this m.code.
It is a very good resource. However, the m files of examples could have more comments. For example, in example 1 it does not explain what is used as initial guess.
F.L. Lewis , Optimal Estimation , NY John Wiley & Sons, 1986
I am working on CFD(nonNewtonian). The tutorial by Dr.Jacek helped me a lot to improve my skills.
Mr.Kierzenka,thanks a lot.The tutorial is very useful.
Helped me a whole lot!!  from zero knowledge of Matlab to calculation of the polyelectrolyte density distributions in colloid crystals (involving nonlinear coupled systems of BVP's) in 3 weeks! Without bvp4c and this tutorial, i'd be torturing Fortran, c++ and myself as we speak.
Summarize everything you need to know
perfect to learn.
good
i ned matlab r14, because i will do the project with the the help of this software
much helpful to begineers