# Increasing precision of second order boundary value problem

2 ビュー (過去 30 日間)
bahadir turkyilmaz 2020 年 8 月 11 日

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 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),'.')

サインインしてコメントする。

### Community Treasure Hunt

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

Start Hunting!