Syntax x = fmin('fun',x1,x2)
17 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
work wolf
el 31 de Ag. de 2016
Comentada: Star Strider
el 1 de Sept. de 2016
Syntax
x = fmin('fun',x1,x2)
x = fmin('fun',x1,x2,options)
x = fmin('fun',x1,x2,options,P1,P2, ...)
[x,options] = fmin(...)
are not working by matlab? the message from matlab as follows as:
>> f =@(x) x.^3-2*x-5;
>> x = fmin('f', 0, 2)
Undefined function 'fmin' for input arguments of type 'char'.
Did you mean:
>> x = min('f', 0, 2)
Error using min
MIN with two matrices to compare and a working dimension is not supported.
>> x = fminbnd('f', 0, 2)
Cannot find an exact (case-sensitive) match for 'f'
0 comentarios
Respuesta aceptada
Star Strider
el 31 de Ag. de 2016
You’re almost there.
This works:
f =@(x) x.^3-2*x-5;
x = fminbnd(f, 0, 2)
x =
816.4968e-003
18 comentarios
Más respuestas (1)
Walter Roberson
el 31 de Ag. de 2016
"Note: The fmin function was replaced by fminbnd in Release 11 (MATLAB 5.3). In Release 12 (MATLAB 6.0), fmin displays a warning message and calls fminbnd."
If you are using MATLAB 5.3 or earlier, that is important information for us to know. If you are using something that old, you would use
x = fmin('f', 0, 2)
but you would also have to have created file f.m with content
function y = f(x)
y = x.^3-2*x-5;
2 comentarios
Ver también
Categorías
Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!