che310hw4 - Ch E 310 Fall 2008 - Homework 4 Solutions...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Ch E 310 – Fall 2008 - Homework 4 Solutions Problem 1 bisect.m function V = bisect(T,P,xl,xu) ea=1; % set initial error to be 1 % define parameters for R-K EOS R = 83.14; T_c = 416.3; P_c = 66.8; a = 0.42748*R^2*T_c^2.5/P_c; b = 0.08664*R*T_c/P_c; % define root finding function f = @(P,T,V) P - R*T/(V-b) + a/((V*(V+b))*sqrt(T)); % define bracket function values and initialize guess fl = f(P,T,xl); fu = f(P,T,xu); xnew = xu; % test to see if the chosen bracket contains a root if fl*fu > 0 error( 'bracket does not contain a root' ) else while (ea >= 0.005) % run until result is within defined tolerance xold = xnew; % retain old guess xnew = (xl + xu)/2; % bisect to find new guess fnew = f(P,T,xnew); % evaluate function at new guess if fnew*fu < 0 % re-test to find which side of bracket to update xl = xnew; else xu = xnew; end ea = abs(xnew-xold)/xnew; % calculate absolute approximate error end V = xnew; % return specific volume end hw4_1.m bisect(273+60,440,50,200) % P = 440 bar, 60 C bisect(273+60,1.01325,45,100)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This homework help was uploaded on 03/26/2008 for the course CHEM E 310 taught by Professor Clapp during the Fall '07 term at Iowa State.

Page1 / 4

che310hw4 - Ch E 310 Fall 2008 - Homework 4 Solutions...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online