How can I change this explicit method code to the implicit method code?

f = @(t,y) -100000*y + 99999*exp(-t);
t0 = 0; y0 =0;
h = 0.01; tn = 2;
n = (tn-t0)/h;
t(1)=t0; y(1)=y0;
for i=1:n
t(i+1) = t(i) + h;
y(i+1) = y(i) + (f(t(i),y(i))*h);
end
plot(t,y)

Antworten (0)

Kategorien

Mehr zu Numerical Integration and Differential Equations finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Jun. 2022

Bearbeitet:

am 7 Jun. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by