bvp4c : Unable to meet the tolerance without using more than...

13 views (last 30 days)
Hi,
I am trying to solve a system of two differential equations coupled only by the boundary conditions:
f'' + a1 f² + a2 f + a3 = 0
g'' + a4 g² - a5 g + a6 = 0
f'(-1)=0
g'(0)=0
f'(0)-g'(-1)=0
f(0)-g(-1)-a7=0
where all "a" are real constants. It has to be solved for -1<x<0
My code return:
Warning: Unable to meet the tolerance without using more than 2500 mesh points. The last mesh of 1945 points and the solution are available in the output argument. The maximum residual is 0.0431331, while requested accuracy is 0.001.
I can tell the solution is incorrect because if I change the initial guess I obtain a different solution. Looking on the forum, I followed an advice and increased the tolerance by setting a higher 'Nmax' in bvp4set. The more I increase it, the smaller 'maximum residual' I get, but computing time becomes huge. So far, I tried Nmax=500000, it took about 10 minutes and I still did not get the 'requested accuracy' (0.00310395 instead of 0.001).
Now I keep increasing Nmax, hoping that I will find the true solution in a reasonable amount of time.
Here come my questions : Am I attacking the problem from the right angle? If yes, my problem looks rather simple, so why is it so time consuming? Maybe my guess function is not appropriate?
I point out that I am inexperienced in these things, so I may well have made an obvious mistake somewhere. I am thinking about the guess function in particular.
Here is my code :
function sol = ch3ex1
solinit=bvpinit(linspace(-1,0,10),[1 0 1 0]);
option=bvpset('Nmax',500000);
sol=bvp4c(@ODEs,@BCs,solinit,option);
function dydx=ODEs(x,y)
dydx = [
y(2)
-y(1)^2 + y(1) - 1
y(4)
-y(3)^2 + 2*y(3) - 2
];
function res=BCs(ya,yb)
res=[
ya(2)
yb(4)
yb(2)-ya(4)
yb(1)-ya(3)-0.1
];
end
Thank you for any help.
  1 Comment
Torsten
Torsten on 11 Dec 2014
Maybe MATLAB's dsolve can help you to find an analytical solution for the ODE system from above.
This might help to see why BVP4C is not successful.
Best wishes
Torsten.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!