hw5ish - function[f]=Ratchford_Rice(V) sum=0; global Psat;...

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

View Full Document Right Arrow Icon
Kacie Cruz kc23367 False Position.m function root=false_position(fun,xL,xU) fU=feval(fun,xU); fL=feval(fun,xL); tol=50*eps; error=1; iter=0; xROld=(xU+xL)/2; while error>tol xR=xU-(fU*(xL-xU)/(fL-fU)) if xR>0 xL=xR; else xU=xR; end fU=feval(fun,xU); fL=feval(fun,xL); error=abs((xR-xROld)/xR); xROld=xR; iter=iter+1 end root=xR Test Prob 2 with Prob 1.m function [y]=hw5(x) y=exp(x)-4*x*x; Ratchford_Rice.m
Background image of page 1

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

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

Unformatted text preview: function[f]=Ratchford_Rice(V) sum=0; global Psat; global z; global P; for i=1:3 sum=sum+((z(i)*(Psat(i)/P-1))/(1+V*(Psat(i)/P-1))); end f=sum; Global.m global Psat Psat=[195.75,97.84,50.32]; global z z=[.45,.35,.20]; global P P=110; global lowGuess; lowGuess=.2; global highGuess; highGuess=.8; false_position('Ratchford_Rice',lowGuess,highGuess)...
View Full Document

This note was uploaded on 04/21/2010 for the course PGE 310 taught by Professor Klaus during the Spring '06 term at University of Texas.

Page1 / 2

hw5ish - function[f]=Ratchford_Rice(V) sum=0; global Psat;...

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