clear; format compact; clf

nitems=5;

for test=1:3;

    if test==1; c=16.5485; RI=30; end;
    if test==2; c=3512;  RI=4*60*60; end;
    if test==3; c=10376;  RI=24*60*60;end;


    for x=1:nitems
        for y=1:nitems
            totresponses(x,y)=0.0;
        end
    end

    d=[4 3 2 1 0];
    d=d*2.5;
    d=d+RI;
    stimuli=d;

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

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

    totresponses=prob;

    for norm=1:100;

        sumresp=sum(totresponses);
        for ui=1:nitems;
            totresponses(:,ui)=totresponses(:,ui)/sumresp(ui);
        end

        sumresp=sum(totresponses');
        for ui=1:nitems;
            totresponses(ui,:)=totresponses(ui,:)/sumresp(ui);
        end
    end

    plot((totresponses))
    axis([0 nitems 0 1])
    hold on

end


