Integral approximation with midpoint method
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to write a code for the Integral approximation with the midpoint method.
Mathematically, I was thinking like this: y'(t)=f(t,y(t))=-y(t)
The rectangle rule: y(t + h)=y(t) + h · f(t+h/2,y(t)+h/2*f(t,y(t)))
for:
h=0.5 and y(0)=1 (t0=0, y(t0)=1)
I would like to calculate the next step: t1=t0+h=0.5, y(t1)=?
y(t1)=y(t0+h)=y(t0)+h*f(t0+h/2,y(t0)+h/2*f(t0,y(t0)))=
=1+0.5*f(0.25,1+0.25*f(0,1))=
=1+0.5*f(0.25,1+0.25*(-1))=
=1+0.5*f(0.25,0.75) = 1+0.5*(-0.75)=0.625
I don't know how to represent the function f in Matlab (syms ?) so that it would know to calculate f(0,1) for example.
Can someone help me, please?
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Stability Analysis 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!