Euler's Method for second order ODE

Hello, i am trying to solve y''+(1/2)*y'+5y=0 with initial values of y'(0)=2 and y(0) = 0 using Euler's method. This is my code, can you please tell me how to fix it?

댓글 수: 1

Torsten
Torsten 2022년 1월 16일
편집: Torsten 2022년 1월 16일
Implement your ODE y''+1/2*y'+5y = 0 in function "func", reduce h from 0.5 to 0.05, and the code will run fine.

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

답변 (1개)

Abhiroop Rastogi
Abhiroop Rastogi 2022년 2월 15일

1 개 추천

Hi Mohamed T. Adam,
The implementation of the differential equation, in the method that you have applied in your code, is not accurate. The way your equation would be represented is as follows:
You can find the the above implementation in the file attatched, named "Modified.m", for the modified code. The final output for the above equation will look as given in the figure below.

카테고리

도움말 센터File Exchange에서 Numerical Integration and Differential Equations에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 1월 16일

답변:

2022년 2월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by