function eraseconc(M,N) curd = pwd; cd ../string_proc/combinatorics/ addpcurdir cd(curd) T = 1e8; % indep %M = 10; %N = 6; alf = 'ab'; p = (M-N)/M; DEV = []; E = round(indepExp(M,N)); for t=1:T x = get_datum(alf,M); y = get_datum(alf,N); X = count_subseq(x,y); if X>2*E DEV(end+1) = (X-E); hist(DEV,sqrt(length(DEV))); drawnow end end return function y = rand_erase(x,N) ii = randperm(length(x)); ii = ii(1:N); ii = sort(ii); y = x(ii); return y = []; for i=1:length(x) if rand > p y(end+1) = x(i); end end return function x = get_datum(alf,n) na = length(alf); x = alf(ceil(rand(1,n)*na)); return function E = indepExp(M,N) E = exp(logchoose(M,N) + N*log(1/2)); return