Increasing precision of second order boundary value problem

조회 수: 1 (최근 30일)
bahadir turkyilmaz
bahadir turkyilmaz 2020년 8월 11일
편집: Are Mjaavatten 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
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에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by