Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
19 lines (15 sloc) 489 Bytes
% Aufruf [x, y] = Mittelpunkt(diffgleichung, xIntervall, h, y0);
% [x,y] = Mittelpunkt(@(x, y) (x.^2)./y,(0:0.7:2.1), 0.7 , 0)
function [x,y] = Mittelpunkt(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) + h/2, y(i) + h/2 *k1);
y(i+1) = y(i) + h * k2;
x(i+1) = xIntervall(i+1);
end
end
You can’t perform that action at this time.