format compact
clear
clf

c=1.6928;;

for time=1:4;
    rdelay=0.1;
    firstdelay=10;
    RIind=time;
    if RIind==1; RI=1.5; end
    if RIind==2; RI=3; end
    if RIind==3; RI=6; end
    if RIind==4; RI=12;  end
    rdelay=rdelay*RI/1.5;

    IP=RI*2;

    nitems = 4;

    d=[0 0 0 0];
    for n=1:4; d(n)=d(n)+rdelay; end
    for n=1:3; d(n)=d(n)+RI; end
    for n=1:2; d(n)=d(n)+IP; end
    for n=1:1; d(n)=d(n)+firstdelay; end

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

    dd=[0 0 0 0];

    for i=1:nitems
        for n=1:nitems
            dd(i) = dd(i) + exp(-c*(abs(d(i)-d(n))));
        end
        pcorrh(i)=1/dd(i);
    end
    pcorr=pcorrh(3);

    results(RIind)=pcorr;
end
plot(results)
hold on


