Why my fminsearch do not work?

3 ビュー (過去 30 日間)
Alberto
Alberto 2013 年 7 月 10 日
Hi all! I would like to know why my fminsearch function do not work. The error that I received is: Subscripted assignment dimension mismatch.
Subscripted assignment dimension mismatch.
Error in fminsearch (line 191)
fv(:,1) = funfcn(x,varargin{:});
Error in GINO_programme (line 62)
[A,fval,exitflag] = fminsearch(@GINO_function,y0,options);
the script is:
I FILE
function BA=GINO_function(A)
global DB_temp r T mv_equity_t sig_E
V= A(1,1);
sig_v= A(2,1);
d1=log(V/DB_temp)+(r+(0.5*(sig_v).^2))*T/(sig_v*sqrt(T));
d2=d1-(sig_v*sqrt(T));
BA(1,1)=mv_equity_t- V*normcdf(d1)+ DB_temp*exp(-(r*T))*normcdf(d2);
BA(2,1)=sig_E* mv_equity_t-normcdf (d1)*sig_v*V;
II FILE
options = optimset('Display','iter');
[A,fval,exitflag] = fminsearch(@GINO_function,y0,options);
I used to run this program fsolve but eh sintax of fsolve and fminsearch is the same no? Why matlab creates this error if with fsolve works? Thank you a lot

回答 (1 件)

Matt J
Matt J 2013 年 7 月 10 日
I used to run this program fsolve but eh sintax of fsolve and fminsearch is the same no?
No, fminsearch works with a scalar objective function. Try this instead
[A,fval,exitflag] = fminsearch(@(y) norm(GINO_function(y)),y0,options);

カテゴリ

Help Center および File ExchangeFinancial Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by