clear all; clf
format compact


for cond=1:3;

    if cond==1; retint=15; nitems = 10; c= 12.1; thresh=.53; slope=8.98; end;
    if cond==2; retint=20; nitems = 15; c= 10.82; thresh=.42; slope=12.09; end;;
    if cond==3; retint=25; nitems = 20; c= 9.69; thresh=.35; slope=16.19; end;;


    if cond==1; d=[10 9 8 7 6 5 4 3 2 1];  end
    if cond==2; d=[15 14 13 12 11 10 9 8 7 6 5 4 3 2 1];  end
    if cond==3; d=[20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1];  end

    d=d*2+retint-2;

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

    for itemnum=1:nitems
        dd=0;
        for m=1:nitems
            dd = dd+ exp(-c*(abs(d(itemnum)-d(m))));
        end
        for n=1:nitems
            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 n=1:nitems; serpos(n)=min(1,serpos(n)); end

    plot(serpos)

    axis([1 nitems 0 1.2])
    hold on
end
