optimizing 2 parameters with fmincon

I was optimizing a function named ML with fmincon to find the parameter "theta",
twostage = fmincon(@(theta)ML(theta,param,x,y),theta,[],[],[],[],lb,ub,[],options);
now I want to optimize another function ML2 for two parameters "theta1" and "theta2", can fmincon optimize a function for 2 parameters? how should I write the function?
Thanks

 採用された回答

Matt J
Matt J 2012 年 11 月 30 日
編集済み: Matt J 2012 年 11 月 30 日

0 投票

Make theta a 2x1 vector instead and rewrite ML accordingly, to interpret theta as a 2x1 input vector. Also make ub and lb 2x1.

2 件のコメント

Fred
Fred 2012 年 11 月 30 日
thanks so you mean I should use theta(1) and theta(2) instead of theta1 and theta2 in ML function
Matt J
Matt J 2012 年 11 月 30 日
Yes, although once theta has been passed to ML, there's no reason you couldn't unpack as follows within the ML code:
theta1=theta(1);
theta2=theta(2);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with Optimization Toolbox についてさらに検索

製品

質問済み:

2012 年 11 月 30 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by