function [t,y]=eulerprint(a,b,h,y0) %function [t,y]=eulerprint(a,b,h,y0) %Solution using Euler's Method. Determines a solution y(t) % for t=a to t=b using step size h and initial condition y0. % To change the differential equation, go to the second to % last line- In the command window, type: edit eulerprint.m % %This program will output a text file: output.txt % containing columns of data from Euler's Method. % t=a:h:b; n=length(t); y=zeros(n,1); dy=zeros(n-1,1); y(1)=y0; for i=2:n dy(i-1)=f(t(i-1),y(i-1)); y(i)=y(i-1)+h*dy(i-1); end %These are the output file commands- No need to change these! fid=fopen('output.txt','w'); fprintf(fid,'The first column is time, second is y, third is dy/dt\n'); for j=1:n if j