Merton model+matlab

  • Thread starter Thread starter terance
  • Start date Start date
Joined
5/6/11
Messages
5
Points
11
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
 

Attachments

If this is not your defined code and it is not important to use your custom defined one, we can search for already made optimized model. I have seen many Merton models in C++/VBA not Matlab but there should exist some.
 
If this is not your defined code and it is not important to use your custom defined one, we can search for already made optimized model. I have seen many Merton models in C++/VBA not Matlab but there should exist some.
I'll apreciate if you show me some Merton Model implementations' in VBA
 
I'll apreciate if you show me some Merton Model implementations' in VBA

I have one at home. Don't remember if is the one I have is in VB or C++ but I'm sure I have seen both. I'll notify you when I get home.
 
@terance EDIT:
Credit Risk Modeling using Excel and VBA chapter 13 defines the exact VBA code for Merton model. I'll give you that particular pdf if I get it.
 
Hello,
I'm currently working on the CreditRisk+ framework ( base on the technical document "CreditRisk+ A Credit Risk Management Framework")
I have the VBA code of the Spreadsheet there at the end of the technical document (made by Tom Wilde).
But I have some difficulty to understand the code.
In attachments there is file with the code

Thank you in advance
 

Attachments

Back
Top