Increasing precision of second order boundary value problem
2 views (last 30 days)
Show older comments
Hello, I have one differential boundary value problem.
and f(0)=0 , f(1)=e
I compare numerical solution by matlab (purple line in graphs) and solution obtained by matched asymptotic expansion (yellow stars in graphs). The following graphs are for same solution, in fact second one zoomed version of first one. As it can be seen in graphs in lower booundary solutions are not matching.
The code I used is:
clear all
eps=0.0005;
xmesh = linspace(0,1,100000);
x_dev= linspace(0,1,5000)
solinit = bvpinit(xmesh, @guess);
options = bvpset('AbsTol',10e-6)
sol = bvp5c(@bvpfcn, @bcfcn, solinit,options);
function dydx = bvpfcn(x,y)
eps=0.0005 ;
dydx = zeros(2,1);
dydx = [y(2)
(-x*y(2)+x*y(1))/eps];
end
function res = bcfcn(ya,yb)
res = [ya(1)
yb(1)-exp(1)];
end
function g = guess(x)
g=[exp(x)
exp(x)];
end
How can I improve solution obtained by bvp5c in the lower boundary?
0 Comments
Answers (1)
Are Mjaavatten
on 11 Aug 2020
Edited: Are Mjaavatten
on 11 Aug 2020
Your asymptotic expansion solution seems to have zero slope at y = 0. This implies that the second derivative is zero and the solution is f(y) = 0 for all y >= 0. So it seems that the asymptotic expansion solution is incorrect
Solving your equation as an initial value problem with inital values taken fromthe bvp5c solution recreates that solution. You can verify this by adding the following lines at the end of your code:
[t,z] = ode45(@bvpfcn,[0,1],sol.y(:,1));
plot(sol.x,sol.y(1,:),t,z(:,1),'.')
0 Comments
See Also
Categories
Find more on Numerical Integration and Differential Equations 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!