% relation between firing rate and serieller correlation

input = 65.0;   % lifadapt 100Hz
%input = 8.0;   % lifadapt 10Hz
trials = 10;
tmax = 50.0;
noise = 1e-5;
adapttau = 0.1;
adaptincr = 0.5;

clf;
for adapttau = 0.01:0.02:0.2
    inputs = 1:5:120;
    iscs = zeros( size( inputs ) );
    rates = zeros( size( inputs ) );
    for k = 1:length(inputs)
        input = inputs(k);
        % generate spikes:
        spikes = lifadaptspikes( trials, input, tmax, noise, adapttau, adaptincr );
        isivec = isis( spikes );
        isc = isiserialcorr( isivec, 10 );
        iscs(k) = isc(2);
        rates(k) = 1.0/mean( isivec );
    end

    subplot( 2, 1, 1 );
    hold on;
    plot( inputs, rates );
    hold off;
    subplot( 2, 1, 2 );
    hold on;
    plot( rates, iscs );
    hold off;
end
