I've implemented the modified Euler's method to solve ODEs as described in my lecture (here only important parts):
F = @(x,Y) [Y(2),-sin(Y(1))];
...
for i=1:N
Yh=Y+h/2*F(x,Y);
Y=Y+h*F(x+h/2,Yh);
x=x+h;
...
end
What I don't get is: Why do I give $x$ over to the function $F$? It is not used there, because only the elements of vector $Y$ are used. Therefore it does not make sense to me to give $x$ or $x+h/2$. Can anybody help me?