This preview shows page 1. Sign up to view the full content.
Unformatted text preview: y(i)=hw08_p03AB4(i,h,y(i1),fprime); fprime(i)=hw08_p03deriv(x(i),y(i)); %AM4 corrector y(i) = hw08_p03AM4(i,h,y(i1),fprime); fprime(i)=hw08_p03deriv(x(i),y(i)); end %Display integrated function values and calculated values: % ytrue = x./(1.0+x.^2); % (a) ytrue = 1.0/4.0*(3.0*exp(4.0*x) + 1.0); % (b) % open file fid4 = fopen('hw08_p03_answer.txt','a'); % 'wt' means "write text" if (fid4 < 0) error('could not open file "hw08_p02_answer.txt"'); end; fprintf(fid4,'\n\nh = %10.5f\n', h); fprintf(fid4,'x\t\t\t\ty(x)\t\t\t\tY(x)\t\t\t\terror\n'); for i = 1:length(x) if mod(i1,int_1) == 0 fprintf(fid4,'%15.5f%15.5f%15.5f%15.5f\n', . .. x(i),y(i),ytrue(i), y(i)ytrue(i)); end end fclose(fid4);...
View
Full
Document
This note was uploaded on 02/22/2010 for the course CHE 348 taught by Professor Chelikowsky during the Spring '08 term at University of Texas at Austin.
 Spring '08
 Chelikowsky

Click to edit the document details