How to use the Fminsearch in in MATLAB 6.5?

2 ビュー (過去 30 日間)
XIAOMING
XIAOMING 2011 年 2 月 26 日
hi,dear all
I have use the Fminsearch successfully in matlab R2008b as follows:
[x,yy]=fminsearch(@(x) noncon_obj(x,z1,norm_A,norm_B,exva_A,exva_B),x0);
where,noncon_obj is the target function ,'x' is the variable,and 'z1,norm_A,norm_B,exva_A,exva_B' are the parameters .
function CC=noncon_obj(x,z1,norm_A,norm_B,exva_A,exva_B)
YY=norminv(exp(-exp((x(2)-exva_A+0.45*exva_B)/(-0.7797*exva_B))));
CC=sqrt(((log(x(1))-z1(1))/z1(2))^2+((x(1)-x(2)-norm_A)/norm_B)^2+YY^2);
But, the above code fail to work in matlab 6.5,and give Error: "identifier" expected, "(" found.
Then,how to use the Fminsearch in in MATLAB 6.5 for the function "noncon_obj"

採用された回答

Jiro Doke
Jiro Doke 2011 年 2 月 26 日
You are using anonymous functions, which were introduced in MATLAB 7, so it won't work in MATLAB 6.5. According to the documentation for fminsearch (for MATLAB 6.5), call it by putting the additional parameters as trailing arguments:
[x,yy]=fminsearch(@noncon_obj,x0,[],z1,norm_A,norm_B,exva_A,exva_B);
Notice the [] to represent empty "options" structure.
  1 件のコメント
XIAOMING
XIAOMING 2011 年 2 月 27 日
thanks very much.It's done.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by