problem of function handles, thx
古いコメントを表示
for instance,
parms=ones(2,1);
myfunc = @(parms) X.*parms(1)+Y.*parms(1);
I can directly indicate 'myfunc' in 'fmincon'. [parms,favl]=fmincon(myfunc,parms,....);
However, if I want to separately write 'myfunc' in a function script and then quote it. [parms,favl]=fmincon(myfunc,parms,....); the 'fmincon' will report 'Not enough input in myfunc'.
X and Y are variables stored in workspace, they are not unknown parameters, only parms(1) and parms(2) required estimation.
anyone can tell me how to solve this problem? many thanks!
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Debugging and Analysis についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!