Shooting method for boundary value problems
6 ビュー (過去 30 日間)
古いコメントを表示
I use ODE45 and the shooting method to solve boundary value problems. There was a specific case in second order differential equations, where an unknown initial condition (which is to be found using shooting method) is a part of the expression of the second derivative, something like the following code. I want to know how to include it in the function and do I need to use any looping statements for it.
funtion dy = diffe(x,y)
l = 2;
p = 3;
dy = [y(2); p*x^2+2*y(1)+y0];
end
So in this code, value of dy/dx at x=0 is known but the value of y at x=0 is not known, but the value of y at x=1 (second boundary is known). This function is to be called like this:
funtion odesolver
dy0 = 0;
[x,y] = ode45(@diffe, [0 1], [y0, dy0]);
end
If someone can recommend a solution to this, that'll be very helpful.
回答 (1 件)
Basavaraj
2024 年 10 月 29 日
funtion dy = diffe(x,y)
l = 2;
p = 3;
dy = [y(2); p*x^2+2*y(1)+y0];
end
funtion odesolver
dy0 = 0;
[x,y] = ode45(@diffe, [0 1], [y0, dy0]);
end
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Ordinary Differential Equations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!