Why my objective function is not evaluating the function for an initial value?
Mostrar comentarios más antiguos
I have a function like the following:
function y=testfuncopt(a,b,c)
y=a(1).^2+a(2).^2-b(1).^2-2*b(2).^2+c;
Now I want to evaluate the function for an initial value x0:
x0=[1,2,3,2,1]
objective =@(a,b,c) @testfuncopt;
disp(['Initial Objective: ' num2str(objective(a,b,c))])
The follwoing error happening:
Undefined function or variable 'a'.
Error in testopt1 (line 12)
disp(['Initial Objective: ' num2str(objective(a,b,c))])
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Whos 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!