Solving a System of ODEs using Euler's method

조회 수: 71 (최근 30일)
Lionel Mends
Lionel Mends 2021년 9월 14일
답변: Jan 2021년 9월 14일
Hi,
I am having trouble finding a solution to a sytem of ODEs using Euler's method. I have tried several codes with several parameters, but I don't seem to get the right results. I have in addition to this text included the problem and my code as references. Any assitance would be greatly appreciated. Thanks
The code

답변 (1개)

Jan
Jan 2021년 9월 14일
Your function to be integrated depends on t also. You call this x in the Euler method.
At is easier to use vector equations:
f = @(t,y) [-t*y(1) - y(2); -y(1) + t * y(2)];
...
y(:, i + 1) = y(:, i) + h * f(t(i), y(:, i));

카테고리

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