{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture 15

# Lecture 15 - Hand Calculation Example Bisection Method iter...

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

Hand Calculation Example [ ] [ ] 2 3 0 2 x , x estimeates initial 0 3 x 2 x x f Example u l 2 . , . ) ( : = = - - = 0375 0 02496 0 99375 2 0125 3 975 2 6 075 0 0502 0 0125 3 05 3 975 2 5 15 0 0994 0 975 2 05 3 9 2 4 3 0 2025 0 05 3 2 3 9 2 3 6 0 39 0 9 2 2 3 6 2 2 2 1 44 1 6 2 2 3 0 2 1 x x f x x x iter r r u l . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ) ( - - - - Bisection Method f(2) = - 3, f(3.2) = 0.84

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

View Full Document
Hand Calculation Example [ ] [ ] 2 3 0 2 x , x estimeates initial 0 3 x 2 x x f Example u l 2 . , . ) ( : = = - - = Bisection Method -3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 2 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9 3 3.1 3.2 3.3
You need to specify the function “func” when calling this function M-file in textbook

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

View Full Document
break: terminate a “for” or “while” loop a x b ya yb y Use “feval” to evaluate the function “func” An interactive M-file
1. Find root of Manning ' s equation 2. Two other functions ( 29 ( 29 0 S 2h b bh n 1 Q f(h) 1/2 2/3 5/3 = + - = Examples: Bisection 0 x e ) x ( f 2 x = - = - 0 1 x 3 x ) x ( f 3 = + - =

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

View Full Document
Bisection Method for Manning Equation »bisect2( 'manning' ) enter lower bound xl = 0 enter upper bound xu = 10 allowable tolerance es = 0.00001 maximum number of iterations maxit = 50 Bisection method has converged step xl xu xr f(xr) 1.0000 0 10.0000 5.0000 264.0114 2.0000 5.0000 10.0000 7.5000 -337.3800 3.0000 5.0000 7.5000 6.2500 -25.2627 4.0000 5.0000
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}