fminbnd finding wrong minimum point, please help
Mostrar comentarios más antiguos
clc,clear
f = @(x)((15*x)./(4*x.^2-3*x+4));
x = fminbnd(f, 0, 10);
x
y=f(x);
y
i think it should find x=0 and y=0 but it doesn't. it finds x =
9.9999
y =
0.4011
why is that, please help me.
Respuesta aceptada
Más respuestas (2)
Matt Tearle
el 18 de Oct. de 2011
Don't expect fminbnd to do what you'd do in a Calculus class: look for local minima in the interval and compare with the endpoints. From the documentation:
Its algorithm is based on golden section search and parabolic interpolation. Unless the left endpoint x1 is very close to the right endpoint x2, fminbnd never evaluates fun at the endpoints, so fun need only be defined for x in the interval x1 < x < x2.
Note that the algorithm is a local minimum technique. So although fminbnd seems like it would be a global minimizer (on a closed interval), it isn't -- it's a local minimizer, but will call an endpoint (actually just close to the endpoint) a local minimum if the function is decreasing as you approach it.
x = fminbnd(f, 0, 10,optimset('Display','iter'))
will show the progress.
1 comentario
Emre
el 18 de Oct. de 2011
Emre
el 19 de Oct. de 2011
0 votos
Categorías
Más información sobre Blue en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!