This preview shows page 1. Sign up to view the full content.
Unformatted text preview: Secant function file function x = secant(fun, x0, x1) xp = x0; fp = feval(fun,xp); x = x1; fx = feval(fun,x); n=5; for i = 1:n xn = x - fx * (x - xp) / (fx - fp); xp = x; fp = fx; x = xn; fx = feval(fun,x); end Script file secant( 'colebrook' ,0.006,0.007) ans = 0.0108...
View Full Document
This note was uploaded on 11/10/2010 for the course PGE 323K taught by Professor Lake during the Spring '08 term at University of Texas at Austin.
- Spring '08