function nr=xberni(X, r) % xberni(X, r) Generates a column vector for the wait time for the rth % positive in each expirement of the Bernoulli random variable matrix X. % If the rth positive does not occur, the result is infinity. The % resulting vector is a Pascal random variable. if sum(sum(X==1))+sum(sum(X==0))length(f) nr(i)=Inf; else nr(i)=f(r); end end