Hello!I'm having some troubles with implemening Merton model in matlab
here is my code of m-file
function y = mm(x,D,r,delta_t,S,sigma_s)
d1=(log(x(2)/D)+(r-0.5*x(1)*x(1)*delta_t))/(x(1)*sqrt(delta_t));
d2=d1-x(1)*sqrt(delta_t);
y=((sigma_s*S-normcdf(d1,0,1)*x(1)*x(2))^2+(S-x(2)*normcdf(d1,0,1)-D*exp(-r*delta_t)*normcdf(d2,0,1))^2);
I use the following command to run this function
x=fminsearch('mm(x,5000000,0.0071,2548,74513269760,0.000665992)',[10 0.0001])
(the basic idea to solve the system of 2 non-linear equations is to find the minimum of G^2(x,y)+F^2(x,y))
But, I receive only 10 and 0.0001 in answer, it is wrong answer (as captaine obviusly told me)))
In attachments there is file with non-linear equations
here is my code of m-file
function y = mm(x,D,r,delta_t,S,sigma_s)
d1=(log(x(2)/D)+(r-0.5*x(1)*x(1)*delta_t))/(x(1)*sqrt(delta_t));
d2=d1-x(1)*sqrt(delta_t);
y=((sigma_s*S-normcdf(d1,0,1)*x(1)*x(2))^2+(S-x(2)*normcdf(d1,0,1)-D*exp(-r*delta_t)*normcdf(d2,0,1))^2);
I use the following command to run this function
x=fminsearch('mm(x,5000000,0.0071,2548,74513269760,0.000665992)',[10 0.0001])
(the basic idea to solve the system of 2 non-linear equations is to find the minimum of G^2(x,y)+F^2(x,y))
But, I receive only 10 and 0.0001 in answer, it is wrong answer (as captaine obviusly told me)))
In attachments there is file with non-linear equations