Filter löschen
Filter löschen

return column vector (t(i+1) & y(i+1)) instead of row vector

2 Ansichten (letzte 30 Tage)
ken
ken am 3 Apr. 2022
Beantwortet: Walter Roberson am 3 Apr. 2022
function [y,t] = euler_timestep(f,t0,tf,alpha,N)
h=(tf-t0)/N;
t(1)=t0;
y(1)=alpha;
for i=1:N
t(i+1)=t(i)+h;
y(i+1)=y(i)+h*f(t(i),y(i));
end

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 3 Apr. 2022
t = zeros(N+1,1);
y = zeros(N+1,1);

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by