using midpoint method, Exercises of Mathematics

how to use midpoint method to solve differential equations

Typology: Exercises

2021/2022

Uploaded on 04/06/2022

myaseen
myaseen 🇨🇦

3 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
a = (left end of the domain);
b = (right end of the domain);
h = (step size);
F = @(s,r) (function y'=...);
t = a:h:b;
y = zeros(size(t));
y(1) = (initial data);! % set the initial condition
for n=1:length(t)-1
y(n+1) = y(n) + h*F(t(n) + h/2, y(n) + (h/2)*F(t(n),y(n)))
end

Partial preview of the text

Download using midpoint method and more Exercises Mathematics in PDF only on Docsity!

a = (left end of the domain); b = (right end of the domain); h = (step size); F = @(s,r) (function y'=...); t = a:h:b; y = zeros(size(t)); y(1) = (initial data); % set the initial condition for n=1:length(t)- y(n+1) = y(n) + hF(t(n) + h/2, y(n) + (h/2)F(t(n),y(n))) end