% % program to solve the ODE % % dy/dt = exp(-a*y^2) % clear % if you use the clear command after the global declaration % it clears the global global a y0=input(' enter initial value of y: '); a=input(' enter value of a: '); tfinal=input(' enter final time: '); t0=0; tstep=(tfinal-t0)/100; tspan=0:tstep:tfinal; % note that although by we have specified a range of % t values at which the result is required (tspan) % the routine still calculates the solution on a variable % time grid, as required for high accuracy and efficiency % [t,y]=ode45('simple_rhs', tspan, y0); plot(t,y) title('solution of dy/dt=exp(-a*y^2)'); xlabel('time(t)');