フィルターのクリア

I need a detailed explination of this code

2 ビュー (過去 30 日間)
Sonja Cortes
Sonja Cortes 2020 年 3 月 24 日
回答済み: Ameer Hamza 2020 年 3 月 24 日
So I have this script but i have no clue what it does, and I got the text that says that it is Euler's method to find an approximate solution to the startvalue problem
y' = sin(sqrt(x+y)) with the start value y(0) = 0.4
on the intervall [0,20]. And the following code implements Euler's methode and plots the graph for the approximat solution of y.
But I was wondering what this script does.
So can someone please explain to me line by line what it does?
ymark = @(x,y) sin(sqrt(x+y));
t = 0:0.01:20;
y = zeros(1,length(t));
y(1) = 0.04;
dt = diff(t);
for s= 1:length(t)-1
y(s+1) = y(s)+dt(s)*ymark(t(s),y(s));
end
plot(t,y)
  1 件のコメント
John D'Errico
John D'Errico 2020 年 3 月 24 日
編集済み: John D'Errico 2020 年 3 月 24 日
Do you have any clue what a differential equation is, what it means, etc.? Because Euler's method is the most basic numerical method you will ever see for solving an ordinary differetial equation.
This is what students are taught when they are introduced to the idea of solving an ODE numerically. In fact, the comments that you show, indicate exactly the differential equation that is approximately solved, including the initial value at t==0.
So are you asking someone to tutor you about differential equations from scratch? Taught well, this usually involves a semester or two.

サインインしてコメントする。

回答 (1 件)

Ameer Hamza
Ameer Hamza 2020 年 3 月 24 日

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by