Solving third order nonlinear boundary value problem
Show older comments
I have a boundary value problem in this form:
where alpha is a nonzero constant and boudary conditions are:
f(-1) = 0
f(0) = 1
f(1) = 0
How can I solve this problem using bvp5c?
5 Comments
David Goodmanson
on 22 Dec 2020
Edited: David Goodmanson
on 22 Dec 2020
Hi parham,
This looks doable if you constuct an f vector of length 6, where the first three elements are f,f',f'' in the left hand region -1<=x<=0 and the second three elements are f,f',f'' in the right hand region 0<=x<=1. Then the differential equation part will be
dfdt(1) = f(2)
dfdt(2) = f(3)
dfdt(3) = a*f(1)*f(2) + 4*a^2*f(2)
and the same for f variables (4,5,6) since the differential equation is the same. At the boundary x = 0, the first and second derivatives of f have to be continuous across the boundary. So for the boundary part in terms of fa and fb, remembering that the a,b boundaries are -1,0 for f (1,2,3) and 0,1 for f(4,5,6) ,the follwing values are zero:
fa(1)
fb(1)-1
fa(4)-1
fb(4)
fb(2)-fa(5) % continuous 1st derivative
fb(3)-fa(6) % continuous 2nd derivative
PRITESH
on 27 Sep 2023
I have the exact same equation, and I understood everything about your code, except for one thing.
Instead of dfdt(3) = a*f(1)*f(2) + 4*a^2*f(2), shouldn't it be dfdt(3) = -a*f(1)*f(2) - 4*a^2*f(2) ?
Torsten
on 27 Sep 2023
Instead of dfdt(3) = a*f(1)*f(2) + 4*a^2*f(2), shouldn't it be dfdt(3) = -a*f(1)*f(2) - 4*a^2*f(2) ?
Yes.
I am trying to use bvp4c and am getting singular Jacobian values.
I don't:
alpha = 1;
xc = 0;
xmesh = [linspace(-1,xc,1000),linspace(xc,1,1000)];
solinit = bvpinit(xmesh, [0 0 0]);
sol = bvp5c(@(x,y,r)f(x,y,r,alpha),@bc,solinit);
plot(sol.x,sol.y(1,:))
function dydx = f(x,y,region,alpha)
dydx = [y(2);y(3);-alpha*y(1)*y(2)-4*alpha^2*y(2)];
end
function res = bc(yl,yr)
res = [yl(1,1);yr(1,1)-1;yr(1,1)-yl(1,2);yr(2,1)-yl(2,2);yr(3,1)-yl(3,2);yr(1,2)];
end
Answers (0)
Categories
Find more on Function Creation 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!