fzero function not working for equation, says undefined for double
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Jessica Hainline
el 4 de Mzo. de 2022
Respondida: Walter Roberson
el 4 de Mzo. de 2022
Editor:
function f=HW6Q2(x)
f=3*cos(x^(1/5))-x^3;
Command Window:
>> x=fzero(@HW6Q2,1)
Error using fzero>localFirstFcnEval (line 729)
FZERO cannot continue because user-supplied function_handle ==> HW6Q2 failed with the error below.
Undefined function 'HW6Q2' for input arguments of type 'double'.
Error in fzero (line 286)
fx = localFirstFcnEval(FunFcn,FunFcnIn,x,varargin{:});
I have no idea why this is wrong. How do I get my function to handle a 'double'?
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de Mzo. de 2022
x=fzero(@HW6Q2,1)
function f=HW6Q2(x)
f=3*cos(x^(1/5))-x^3;
end
You must not have saved the code under the file name HW6Q2 somewhere on your MATLAB path.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Problem-Based Optimization Setup 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!