Euler's method

1 次查看(过去 30 天)
Abd Sad
Abd Sad 2021-1-13
Help
  1 个评论
James Tursa
James Tursa 2021-1-13
What have you done so far? What specific problems are you having with your code?

请先登录,再进行评论。

回答(2 个)

WalterWhite
WalterWhite 2021-1-13

Steve Areola
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)

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by