Why my objective function is not evaluating the function for an initial value?
古いコメントを表示
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))])
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!