No BSD License  

Highlights from
Implied Default Probability Function

from Implied Default Probability Function by David Wang
This function is to calculate the implied default probability from the DOC model.

Ans=N(x)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This function is to calculate values of N(.) to within six decimal places accuracy. Haug(1998) %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function Ans=N(x)

a1=0.31938153;
a2=-0.356563782;
a3=1.781477937;
a4=-1.821255978;
a5=1.330274429;

L=abs(x);

k=1/(1+0.2316419*L);

Ans=1-1/sqrt(2*pi)*exp(-L^2/2)*...
    (a1*k+a2*k^2+a3*k^3+a4*k^4+a5*k^5);

if x<0
    Ans=1-Ans;
end

Contact us at files@mathworks.com