I have created the following coding below to generate the probability of an asset defaulting 9 or more times in a year. The underlying theory is using simulations of correlated variable X from a jointly distributed matrix into a gaussian one. How can i get the value of probability of 9 or more defaults?

Is my approach used in MATLAB correct? i understand the base theory but maybe i am missing something to calculate it in the program?

N = 30;% Number of assets

NSimu = 250000; % Number of simulations

mu = zeros(N,1); % Mean vector

rho = 0.2;

S = rho*ones(N) + (1-rho)*eye(N); % Correlation matrix

r = mvnrnd(mu, S, NSimu);% Correlated X variables

%Cov=corr(r); % Covariance/Correlation matrix

U=normcdf(r);%Transforming multivariate to univariate cdf(gaussian).

h=0.1; %Intensity factor of default

tau=-log(cdf(‘Normal’,U,0,1))/h; %Calculating default times via gaussian

%Finding the probability for 9 or more default?? <– Solution required to this