Euler's method
2 ビュー (過去 30 日間)
古いコメントを表示
Help
1 件のコメント
James Tursa
2021 年 1 月 13 日
What have you done so far? What specific problems are you having with your code?
回答 (2 件)
Steve Areola
2023 年 8 月 5 日
clc
a=0;b=2;N=10; alph=0.5;
h=(b-a)/N; t(1)=a; w(1)=alph;
f = @(t,y) y-t^2+1;
for i=2:N+1
t(i)=a+(i+1)*h;
w(i)=w(i-1)+h*f(t(i-1),w(i-1));
end
disp("t w")
x=[t;w];
fprintf("%5.9f %5.9f\n",x)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Startup and Shutdown についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!