Coupeling of three equations BVP
    5 views (last 30 days)
  
       Show older comments
    
Dear all,
I have a maths understanding problem with the following code. I tried to couple three ode equations with another and solved them with a bvp solver. As for the boundary conditions I applied all (just as an example) to the second derivative since in my problem I want to set Newmann boundary conditions.
However, what I noticed is that I am not able to give the third equation a dependence on C. The system is only solvable with Eq. dydx(6) decoupled from C. 
How would I be able to solve the system with including a dependence of Eq. dydx(6) with C. Is a boundary condition to dydx(1), dydx(3) or dydx(5) nessecary in all cases if I want to solve this kind of system? I hope somebody more gifted in maths can help me with that.
Thanks for you help!
clear all;
close all;
clc;
xmesh = linspace(0, 1, 100);
sol_init = bvpinit(xmesh, [0 0 1 0 0 1]);
sol = bvp4c(@ode, @bcfun, sol_init);
plot(sol.x, sol.y)
function dydx = ode(x,y)
A = y(1);
B = y(3);
C = y(5);
S = exp(A*B)-C;
dydx(1) = y(2);
dydx(2) = S;
dydx(3) = y(4);
dydx(4) = -S;
dydx(5) = y(6);
dydx(6) = exp(A+B);
% dydx(6) = C;
end
function res = bcfun(ya, yb);
res(1) = ya(2);
res(2) = yb(2);
res(3) = ya(4);
res(4) = yb(4);
res(5) = ya(6);
res(6) = yb(6);
end
0 Comments
Answers (1)
  James Blanchard
 on 17 Jun 2024
        I get errors with both choices for dydx(6). They seem to result from your initial guesses (sol_init). Try something different.
2 Comments
  Torsten
      
      
 on 17 Jun 2024
				There is no solution from bvp4c for 
dydx(6) = exp(A+B);
either (see above).
The reason is that your equations only fix the derivative of y(5). So in my opinion, y(5) is only fixed by your equations up to an additive constant.
See Also
Categories
				Find more on Boundary Value Problems in Help Center and File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


