Increasing precision of second order boundary value problem

1 次查看(过去 30 天)
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?

回答(1 个)

Are Mjaavatten
Are Mjaavatten 2020-8-11
编辑:Are Mjaavatten 2020-8-11
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),'.')

类别

Help CenterFile Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by