{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# sol_hw3 - CE 335 Solutions to Homework 3 9(a(40 0...

This preview shows pages 1–3. Sign up to view the full content.

CE 335 Solutions to Homework 3 9) (a) (40 - 0) degC / (2*0.05) degC = 400 (need to reduce the range by this factor). log2(400) = 8.64, so 9 iterations (the maximum absolute error will decrease by a factor of 2 each iteration). (b) function T = find_T(DO) %returns the saturation temperature (degC) for a dissolved oxygen concentration (in the range 6.421 to 14.621 mg/L) ldo = log(DO); %function to find a root for f = @(Ta, ldo) -ldo - 139.34411 + 1.575701E5/Ta - 6.642308E7/(Ta^2) + 1.243800E10/ (Ta^3) - 8.621949E11/(Ta^4); %convert from centigrade to Kelvin a = 0 + 273.15; b = 40 + 273.15; fa = f(a, ldo); fb = f(b, ldo); if fa == 0 T = a - 273.15; return elseif fb == 0 T = b - 273.15; return end %ensure a bracketing interval if fa*fb > 0 error('Saturation temperature for the given dissolved oxygen concentration is not between 0 and 40 centigrade') end n_iters = 9; %from part a for i = 1:n_iters c = (a + b) / 2; fc = f(c, ldo);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
if fc == 0 T = c - 273.15; return elseif fa*fc > 0 a = c; else b = c; end end c = (a + b) / 2; T = c - 273.15; %return degrees centigrade Testing: find_T(8) >> 26.76 find_T(10) >> 15.35 find_T(12) >> 7.461 16) The first step is to find a bracketing interval. We start by rewriting the equation as n(N) = 1/(qρμ)
This is the end of the preview. Sign up to access the rest of the 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