# How should I get multiple solutions related to different BCs in this script?

1 view (last 30 days)
Elia Paini on 1 May 2021
Hi, I'm solving a system of ODEs with BCs, with bvp4c function.
My simplified script is as follows:
rmesh = ...
solinit = ...
sol = bvp4c(@bvpfcn,@bcs,solinit);
function dydr = bvpfcn(r,y)
...
end
function res = bcs(ya,yb,C)
...
end
In this case, I solved this system with prefixed values of BCs, reported inside of the second function with the vector C. Thus, I have only one solution, which is related to those BCs values.
However, I'd like to solve this problem with a for loop, through different vectors as input in BCs function in order to have multiple distict solutions, one for every BCs I inserted.
Is this the correct way?
for i=1:10 % 10 vectors of BCs
rmesh= ...
solinit= ...
sol = ??
end
Obviously, I should pass one BC at a time, but I'm interested to do it all together.
Thank you!

### Community Treasure Hunt

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

Start Hunting!

Translated by