Step 1: Create a file called euler_simple.m whose contents are: function [x,y] = euler_simple(x0,y0,xfinal,n) h = (xfinal - x0)/n; x(1) = x0; y(1) = y0; for i=1:n, y(i+1) = y(i) + h*f(x(i),y(i)); x(i+1) = x(i) + h; end Step 2: Create a file called f.m whose contents are: function yp = f(x,y) yp = x + y; Step 3: Solve the problem using Matlab by typing x0 =0; y0=-0.5; xfinal=2; n=40; [x,y] = euler_simple(x0,y0,xfinal,n); plot(x,y) % We also see the solution plot! A better way is to put every thing above in the file called main.m.