Why my fminsearch do not work?

3 Ansichten (letzte 30 Tage)
Alberto
Alberto am 10 Jul. 2013
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

Antworten (1)

Matt J
Matt J am 10 Jul. 2013
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);

Kategorien

Mehr zu Financial Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by