Boundary Value Problem with non boundary values

For solving a Boundary Value Problem with non boundary values (for instance a second order differential defined at [0,1] with values at x=0.2 and x=1) is there a way only using bvp4c except from solving at [0.2,1] and afterwards using bvpxtend for predicting solution's behaviour ?
General suggestions are also welcomed !

6 件のコメント

Torsten
Torsten 2021 年 5 月 28 日
Your problem description is unclear.
Charalampos Papargyriou
Charalampos Papargyriou 2021 年 5 月 28 日
Ode equation is x^2 *y''(x) = exp(x) defined in [0,1] with Dirichlet boundary values y(0.2) = -1 and y(1) = +2
Torsten
Torsten 2021 年 5 月 28 日
編集済み: Torsten 2021 年 5 月 28 日
Solve your equation on [0,1] by taking the boundary value at x=1 and assuming a boundary value at x=0. Evaluate this solution at x=0.2. Usually, this value won't be the same as the prescribed condition at x=0.2. Use fzero to adjust the boundary condition at x=0 such that both values become the same.
By the way:
Your problem has an analytical solution
y(x)=(x-1)*Ei(x)+6.44286*x-exp(x)-1.72458
where Ei(x) is the exponential integral.
So this example is much suited to test the method I suggested above.
Torsten
Torsten 2021 年 5 月 29 日
編集済み: Torsten 2021 年 5 月 29 日
This is a possible implementation (untested !)
The nonlinear equation solver "fzero" tries to find y'(1) such that the solution of the ODE passes through the point (0.2,-1).
function main
y0dot0 = -1.0;
y0dot = fzero(@fun,y0dot0);
tstart = 1.0;
tend = 1e-8;
tspan = [tstart tend];
y0 = [2 y0dot];
[T,Y] = ode15s(@ode,tspan,y0);
plot(T,Y(:,1))
end
function s = fun(y0dot)
tstart = 1.0;
tend = 0.2;
tspan = [tstart tend];
y0 = [2 y0dot];
[T,Y] = ode15s(@ode,tspan,y0);
s = Y(end,1) + 1;
end
function dy = ode(t,y)
dy = [y(2);exp(x)/x^2];
end
Alex Sha
Alex Sha 2021 年 6 月 19 日
Hi, look at your ODE function: y'' = exp(x)/x^2, if x=0, will cause the error of 0/0 .
Lewis Fer
Lewis Fer 2021 年 6 月 19 日
編集済み: Lewis Fer 2021 年 6 月 19 日

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

 採用された回答

Jan
Jan 2021 年 5 月 28 日
編集済み: Jan 2021 年 5 月 28 日

0 投票

6 件のコメント

Torsten
Torsten 2021 年 5 月 28 日
But no boundary condition is given at x=0 ...
Jan
Jan 2021 年 5 月 28 日
@Torsten: A good point. I prefer single and multiple-shooting approachs, for which it does not matter, where the conditions appear.
Charalampos Papargyriou
Charalampos Papargyriou 2021 年 5 月 29 日
@Jan such as ?
Jan
Jan 2021 年 5 月 29 日
@Charalampos Papargyriou: I do not understand the question.
Charalampos Papargyriou
Charalampos Papargyriou 2021 年 5 月 29 日
編集済み: Charalampos Papargyriou 2021 年 5 月 29 日
@Jan I am talking about the other "single and multiple-shooting approaches" you prefer .
Do you have any examples of such methods ?
Jan
Jan 2021 年 5 月 30 日

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

その他の回答 (0 件)

カテゴリ

質問済み:

2021 年 5 月 27 日

編集済み:

2021 年 6 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by