How to show all the midpoints on my bisection code?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a code for finding the bisection, but I need to include 3 things please:
- output- Root History a vector containing the sequence of midpoints obtained by the algorithm
- output- the absolute value of the function f(x) at r, i.e., fRoot = f(r)
- input- max iterations
function [R, E] = myBisection(f, a, b, tol)
m = (a + b)/2;
R = m;
E = abs(f(m));
while E(end) > tol
if sign(f(a)) == sign(f(m))
a = m;
else
b = m;
end
m = (a + b)/2;
R = [R, m];
E = [E, abs(f(m))];
end
how do I do this? thanks!!
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Numeric Types에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!