function y = Euler_step_method( final_time, N_steps ) %runs an Euler step method for solving an ODE %from time t=0 to t=final_time %solves y' = t^2 +y^2, y(t=0)=1 y(1) = 1; t(1) = 0; dt = (final_time - t(1)) / N_steps; for i=1:1:N_steps t(i+1) = t(i) + dt; y(i+1) = y(i) + (t(i)^2 + y(i)^2 ) * dt; end plot(t,y)