I am trying to get started with fzero in matlab. Is there any tutorial to be found somewhere
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Karl
el 4 de Sept. de 2022
Respondida: Walter Roberson
el 4 de Sept. de 2022
fzero tutorial needed
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Sept. de 2022
Unless you need specialized options, the basic form is one of
output_variable = fzero(@FUNCTION_NAME, STARTING_GUESS)
output_variable = fzero(@FUNCTION_NAME, [LOWER_BOUND UPPER_BOUND])
or pass in an anonymous function instead of @FUNCTION_NAME
The function indicated must expect exactly one scalar parameter, and must return a scalar real value (not complex)
Example:
format long g
fun = @(x) x.^4 - x.^2 - cos(x)
xsol = fzero(fun, 2.8)
fun(xsol)
Sometimes it is necessary to pass additional options, espcially if you want the output to be plotted as you go.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Optimization 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!