Matlab Demos in the Week-6 Lecture
Contents
The defects of the bisect program in NCM
f=@(x) sin(x);
a= -1; b= 2;
k =
4656634
a =
0
b =
4.9407e-324
A modified bisect program
[x, k]= my_bisect(f, [a, b])
I'm lucky!
x =
0
k =
1074
Zeroin algorithm
fzerogui
ans =
start 0.0000000000000000
start 3.0000000000000000
secant 0.7142857142857143
bisect 1.8571428571428572
iqi 2.4063616984279301
secant 2.0543530213726049
iqi 2.0961473339210830
secant 2.0945147956931258
secant 2.0945514486033541
iqi 2.0945514815423278
secant 2.0945514815423265