clear; format compact; clf
c1=4.1646; c2=5.3661; c3=7.3277; thresh=0.5209; slope=10.2750;

for test=1:3;

    clear prob

    if test==1; c=c1; end; if test==2; c=c2; end; if test==3; c=c3; end

    for nitems=1:20;

        ri=1;

        clear d;

        for i=1:nitems;  d(i)=0; end

        ccc=0;
        for x=nitems:-1:1; d(x)=d(x)+ccc; ccc=ccc+1; end

        for ppp=1:nitems;  d(ppp)=d(ppp)+ri;end

        for n=1:nitems; d(n)=log(d(n)); end

        for itemnum=1:nitems
            dd=0;
            for m=1:nitems+0
                dd = dd+ (exp(-c*(abs(d(itemnum)-d(m)))));
            end
            for n=1:nitems+0
                prob(n,itemnum)=(exp( -c*(abs(d(itemnum)-d(n)))))/dd;
            end
        end

        for k=1:nitems+0; for j=1:nitems;
                prob(k,j)=1/(1+exp(-slope*(prob(k,j)-thresh)));
            end; end

        serpos=sum(prob');
        for i=1:nitems; serpos(i)=min(1,serpos(i)); end

        allprob=prod(serpos);

        propcorr(test,nitems)=100*allprob;

    end
end

plot(propcorr')
hold on



