Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
18 lines (15 sloc) 449 Bytes
% Aufruf:
% [x,y] = Euler_modifiziert(@(x, y) (x.^2)./y, (0:0.7:2.1), 0.7, 0)
function [x, y] = Euler_modifiziert(f, xIntervall, h, y0)
lenX = length(xIntervall);
y = zeros(lenX, 1);
x = zeros(lenX, 1);
y(1) = y0;
x(1) = xIntervall(1);
for i=1:lenX-1
k1 = f(xIntervall(i), y(i));
k2 = f(xIntervall(i+1), y(i) + h * k1);
y(i+1) = y(i) + h/2 * (k1+k2);
x(i+1) = xIntervall(i+1);
end
end
You can’t perform that action at this time.