{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw07_p05 - end fprintf(fid4\n\nh = .5f\n h...

This preview shows page 1. Sign up to view the full content.

% File: hw07_p05.m % Function file: hw07_p05trap.m % Written by Jason Kenny and modified by Sangheon Lee % clc clear c a = 0.25 Si = 0.8 lambda = 1 sigma = 0.25 mu = 1 m t(1) = 0 R(1) = a h = 1/16 tol = 0.0000001; n = 1; n t(n+1) = t(n) + h; [Rpred(n+1), R(n+1)] = hw07_p05trap(t(n), R(n), h, Si, lambda, sigma, mu); n = n+1; n % open file fid4 = fopen('hw07_p05_answer.txt','wt'); % 'wt' means "write text" if (fid4 < 0) error('could not open file "hw07_p05_answer.txt"');
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end; fprintf(fid4,'\n\nh = %10.5f\n', h); fprintf(fid4,'n\t\t\t\tt\t\t\t\tR(t)\n'); fprintf(fid4,'%10d%15.5f%15.5f\n', n,t(n),R(n)); while ( abs( R(n) - R(n-1) ) > tol ) t(n+1) = t(n) + h; [Rpred(n+1), R(n+1)] = hw07_p05trap(t(n), R(n), h, Si, lambda, sigma, mu); n = n+1; if mod(n,20) == 0 fprintf(fid4,'%10d%15.5f%15.5f\n', n,t(n),R(n)); end end fprintf(fid4,'%10d%15.5f%15.5f\n', n,t(n),R(n)); fclose(fid4);...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern