Calling Euler Method to solve Shooting Method

조회 수: 16 (최근 30일)
Muhammad Usman
Muhammad Usman 2021년 5월 8일
댓글: Hira Nur Yesiloglu 2022년 6월 7일
Hi, I am trying to solve a BVP:
y''(x) +5y'(x)+4y(x) = 1 with boundary conditions y(0) = 0 and y(1)=1
using shooting method.
I found many examples by solving such BVP using ode45 but I want to solve it by euler method (not allowed to use built-in command), but I got stuck in doing so.
I need help to do so...
Thanks,

채택된 답변

Alan Stevens
Alan Stevens 2021년 5월 9일
You need to express your 2nd order ode as two 1st order odes
y``(x) + 5y`(x) + 4y(x) = 1
v = dy/dx
dv/dx = y``(x)
So you have
y`(x) = v(x)
v`(x) = 1 - 4*y(x) - 5*v(x)
Now your Euer expressions become
t(i) = t(i-1) + h;
y(i) = y(i-1) + h*v(i-1);
v(i) = v(i-1) + h*(1 - 4*y(i-1) - 5*v(i-1));
and you must supply initial values for both y and v.
  댓글 수: 2
Muhammad Usman
Muhammad Usman 2021년 5월 11일
Thanks
Hira Nur Yesiloglu
Hira Nur Yesiloglu 2022년 6월 7일
mr.usman do you have the complete code using euler?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by