Flow control when looping over BVP4C solver

I have a boundary value problem that I solve using MATLAB's "bvp4c" solver whose solution depends on six parameters. I'm looking to understand how the solution changes when varying two of the six parameters, say P1 and P2. In this sense, assuming there are m, P1-values of interest, and n, P2-values, I want to obtain an mxn array containing the solution over each pair of P1 and P2-values of interest. To do this, I'm writing a code that loops through all the parameter pairs. The code is written so that the previously obtained solution is used as an initial guess for the next parameter value. Most of the time, the previous solution is a good enough initial guess so that the solver alogorithm converges. However, sometimes that's not the case. Is there a way to control the flow using optional outputs from bvp4c so that when the solver doesn't converge, than the loop stops and the array computed up until then is still stored and given as an output?

1 commentaire

Torsten
Torsten le 24 Déc 2021
After each successful call to bvp4c, you could write the result to file.

Connectez-vous pour commenter.

Réponses (0)

Produits

Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by