Shooting method for boundary value problems
조회 수: 8 (최근 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!