Filter löschen
Filter löschen

Euler's method

1 Ansicht (letzte 30 Tage)
Abd Sad
Abd Sad am 13 Jan. 2021
Beantwortet: Steve Areola am 5 Aug. 2023
Help
  1 Kommentar
James Tursa
James Tursa am 13 Jan. 2021
What have you done so far? What specific problems are you having with your code?

Melden Sie sich an, um zu kommentieren.

Antworten (2)

WalterWhite
WalterWhite am 13 Jan. 2021

Steve Areola
Steve Areola am 5 Aug. 2023
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)

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by