Paste: cute euler's method

Author: Rex
Mode: ml
Date: Thu, 2 Sep 2010 16:05:29
Plain Text |
function [w,t ] = euler(f,a,b,n,alpha )
w=zeros(n+1,1);
t=linspace(a,b,n+1);
h=(b-a)/n;
w(1)=alpha;
for i=1:n,
    w(i+1)=w(i)+h*f(t(i),w(i));
end

end

New Annotation

Summary:
Author:
Mode:
Body: