%% Plot netlet formula of Anninos et al.
clear; clf; hold on;
h=0.; c_in=10; c_ex=10;
for theta=1:7;
    rec=0;
    for x=0.:0.01:1.;
        rec=rec+1;
        tmp1=(1-h)*x*c_ex; tmp2=0;
        for i=0:theta-1; tmp2=tmp2+tmp1^i/prod(1:i); end;
        tmp3=h*x*c_in; tmp4=0;
        for i=0:20; tmp4=tmp4+tmp3^i/prod(1:i); end;
        f0(rec)=x;
        f1(rec)=(1-x)*exp(-tmp3)*tmp4*(1-exp(-tmp1)*tmp2);
    end
    plot(f0,f1);
end
plot([0 1],[0 1],'k'); plot([0 1],[1 0],'k')
xlabel('f(t)'); ylabel('f(t+1)');
box on; axis square
