This preview shows page 1. Sign up to view the full content.
Unformatted text preview: % fL = f(L); fR = f(R); tol = 10^-6*(R-L); while abs(R-L) > tol mid = (L+R)/2; fmid = f(mid); if fL*fmid<=0 % There is a root in [L,mid]. R = mid; fR = fmid; else % There is a root in [mid,R]. L = mid; fL = fmid; end end xStar = (L+R)/2;...
View Full Document
- Fall '07