How can I improve accuracy using bvp4c?

1 view (last 30 days)
Elia Paini
Elia Paini on 5 May 2021
Hi, I solved an ODEs system with BCs. The system is a bit complicated, it consists of 10 second order equations (thus, 20 first order equations).
My script is as follows:
xmesh = linspace(1e-6,1.5, 5000);
solinit = bvpinit(rmesh,[0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]);
sol = bvp4c(@bvpfcn,@bcs,solinit);
However, I receive two types of messages (the first is only an example):
1) Warning: Unable to meet the tolerance without using more than 500 mesh points.
The last mesh of 5000 points and the solution are available in the output argument.
The maximum residual is 376.47, while requested accuracy is 0.001.
Or
2) Out of memory
The solution of the system exists but is unrealistic: variables assumes negative values, while they should be always positive.
I tried many things: changing initial guess of solution, xmin and xmax, the number of points specified in linspace, adding the optional Nmax equals to 500000...but I always receive one of the two messages.
What should I do?
Thank you!

Answers (0)

Community Treasure Hunt

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

Start Hunting!