% apple_bad.m : a variant of apple.m to illustrate that MATLAB % wants the first function to be the main function % This file produces the following error upon typing: % sol_two_bad = apple_bad(1,2,100,3) % Error using apple_bad % Too many input arguments. function two_y = f(t,y) two_y = 2 * y end function result = orange(t_0,t_end,N,y_0) h = (t_end - t_0)/N t = [t_0 : h: t_end] y(1) = y_0 for i=1:N y(i+1) = y(i) + h * f(t(i),y(i)) end result = y end