Why my objective function is not evaluating the function for an initial value?
Show older comments
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))])
Accepted Answer
More Answers (0)
Categories
Find more on Whos in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!