Tema5 - 5.13 (a) n= log(35 / .05) = 9.45 or 10 iterations...

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

View Full Document Right Arrow Icon
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
5.13 ( a ) iterations 10 or 45 . 9 ) 2 log( ) 05 . / 35 log( = = n ( b ) iteration x r 1 17.5 2 26.25 3 30.625 4 28.4375 5 27.34375 6 26.79688 7 26.52344 8 26.66016 9 26.72852 10 26.76270 for o s = 8 mg/L, T = 26.7627 o C for o s = 10 mg/L, T = 15.41504 o C for o s = 14mg/L, T = 1.538086 o C 5.14 Here is a VBA program to implement the Bisection function (Fig. 5.10) in a user-friendly program: Option Explicit Sub TestBisect() Dim imax As Integer, iter As Integer Dim x As Single, xl As Single, xu As Single Dim es As Single, ea As Single, xr As Single Dim root As Single Sheets("Sheet1").Select Range("b4").Select xl = ActiveCell.Value ActiveCell.Offset(1, 0).Select xu = ActiveCell.Value ActiveCell.Offset(1, 0).Select es = ActiveCell.Value ActiveCell.Offset(1, 0).Select imax = ActiveCell.Value Range("b4").Select If f(xl) * f(xu) < 0 Then root = Bisect(xl, xu, es, imax, xr, iter, ea) Else MsgBox "No sign change between initial guesses" End If End Sub
Background image of page 4
Function Bisect(xl, xu, es, imax, xr, iter, ea) Dim xrold As Single, test As Single iter = 0 Do xrold = xr xr = (xl + xu) / 2 iter = iter + 1 If xr <> 0 Then ea = Abs((xr - xrold) / xr) * 100 End If test = f(xl) * f(xr) If test < 0 Then xu = xr ElseIf test > 0 Then xl = xr Else ea = 0 End If If ea < es Or iter >= imax Then Exit Do Loop Bisect = xr End Function Function f(c) f = 9.8 * 68.1 / c * (1 - Exp(-(c / 68.1) * 10)) - 40 End Function For Example 5.3, the Excel worksheet used for input looks like:
Background image of page 5

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

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

This note was uploaded on 03/13/2012 for the course AEROSPACE 301 taught by Professor Pfchang during the Spring '12 term at Shandong University.

Page1 / 10

Tema5 - 5.13 (a) n= log(35 / .05) = 9.45 or 10 iterations...

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

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