File Exchange

## Tutorial on solving BVPs with BVP4C

version 1.2.0.1 (197 KB) by

Solving boundary value problems with BVP4C. Tutorial + Examples.

4.11321
50 Ratings

Updated

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 M-files 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).

Jacek Kierzenka, Lawrence F. Shampine,
A BVP Solver based on Residual Control and the MATLAB PSE,
ACM TOMS, Vol. 27 (2001), No. 3, pp. 299-316.

or in the book

L.F. Shampine, I. Gladwell, and S. Thompson,
Solving ODEs with MATLAB, Cambridge University Press, 2003.

Matteo Melai

Xingkong Wei

### Xingkong Wei (view profile)

raghuveer manikanta

Tarique Shaikh

Jiafu Liu

Ahsan Ahsan

rohith reddy

amin nikravesh

### amin nikravesh (view profile)

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,:))

Faqiha Sultan

### Faqiha Sultan (view profile)

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

Luan Trinh

### Luan Trinh (view profile)

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.

Cara

### Cara (view profile)

How do I actually watch this file? Website is taking me in circles.

Jules

### Jules (view profile)

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.

Jakler

Ali

### Ali (view profile)

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];

Nayyar Mehmood

### Nayyar Mehmood (view profile)

Its good for beginners

Giulia

### Giulia (view profile)

I can't understand how can I chose the right guess... and for examples the two guesses in example 1. Can somebody help me?

Ali MalekpourKoupaei

### Ali MalekpourKoupaei (view profile)

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,

sandeep reddy n

Nayyar Mehmood

SAGAR CHOWDHURY

### SAGAR CHOWDHURY (view profile)

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?

Elif Hocaoglu

### Elif Hocaoglu (view profile)

Dr. Rajeev Shrivastava

MASIALA MAVUNGU

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 two-point boundary value problems.

sharareh Bayat

Hello, I want to solve 24 diffrential equations in matlab using BVP4C but it says singular jacobian . could you please help me

Excsellent

chaudhari urmila

Excellent

harvinder kaur

judith p

bhbh ffff

Poor
Needs Improvement

Fabricio Nápoles

prakriti trivedi

Valery Naunyka

You strongly help me to solve my numerical problem

wahid ghanem

Mircea-Jean Cristea

John D'Onofrio

Daniel Magohe

I hope people with basic knowledge of pure mathematics will find it quite useful.

Sunil Arya

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.

mohammed kalil

F.L. Lewis , Optimal Estimation , NY John Wiley & Sons, 1986

Nikolaos Tubanos

Francesco Sarnari

abdullah al-khudhiri

Leonardo Molisani

Troy Eastin

lisa jam

BIKASH SAHOO

I am working on CFD(non-Newtonian). The tutorial by Dr.Jacek helped me a lot to improve my skills.

Leo Trav

kong dong

Mr.Kierzenka,thanks a lot.The tutorial is very useful.

Matjaz Licer

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.

dhilip kumar ramalingam

David Brooks

Summarize everything you need to know

Volkan Çark

perfect to learn.

w a

Mao Wei

good

raavi kumar

i ned matlab r14, because i will do the project with the the help of this software

kalbin salim

Spyridon Gerontas

khaled khalaf

chi ho