% Time to default of IBM Bond % Montecarlo simulation of Time % Time follows an exponential distribution with Intensity lambda=1/Average T % We double check the simulation with the Cumulative Distribution Function F lambda=0.01 iterations=1000000 average=1/lambda lbound=5 ubound=50 serie = exprnd(average,iterations,1); %over_ubound=(serie>ubound); %below_lbound=(serie< p=""> <> sides= (serie>lbound) & (serie< p=""> <> %results=sum(over_ubound) %results=sum(below_lbound) results=sum(sides) proba=results/iterations %check check=expcdf(ubound,average)-expcdf(lbound,average)
