bisection method disadvantage?
2 ビュー (過去 30 日間)
So, I wrote code for a function to find its roots using the bisection method. I used initial guesses x=4 and 6, knowing that there are no zeros between this interval. When I use the bisection method with the following while loop condition:
while iteration<=30 || abs(xb-xa)> 10^-4
Matlab will spit out that the root in this interval = '6'. What is it about this function/graph interval (from 4 to 6) that makes the bisection method gives me a false zero?
Does it have to do with the graph looking like a straight, horizontal line in this interval?
回答 (1 件)
Jan 2018 年 2 月 26 日
Actually your should be able to find out by your own, why this value is replied. Simply use the debugger to step through your code line by line: https://www.mathworks.com/help/matlab/matlab_prog/debugging-process-and-features.html .