Why my objective function is not evaluating the function for an initial value?
Mostra commenti meno recenti
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))])
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Whos in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!