{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hw11_p03 - end e sum = sum*1.0e-3 Unit conversion from'mg...

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

% Intervals are not constants. So the trapezoidal rule is appropriate. % clear all clc c Q = 0.3 * 60.0; % m^3/min t = [0, 1, 4, 6, 8, 12, 16, 20]; % Time (s) c = [12, 22, 32, 45, 58, 75, 70, 48]; % Position (mg/m^3) m_prime = Q*c; n = length(t); n plot (t, c); p range_a = [0 1]; r % Integration using the trapezoidal rule % sum = 0; for j=1:n-1 % Consider nonconstant intervals sum = sum + (t(j+1)-t(j))*0.5*(m_prime(j) + m_prime(j+1));
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end e sum = sum*1.0e-3; % Unit conversion from 'mg' to 'g' % open file fid4 = fopen('hw11_p03_answer.txt','a'); % 'wt' means "write text" if (fid4 < 0) error('could not open file "hw11_p03_answer.txt"'); end; fprintf(fid4, '\nEstimated accumulated mass = %10.5f g\n', sum); 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