This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/pointprocesses/code/lifinputdiscriminationslope.m
2014-11-12 18:39:02 +01:00

66 lines
1.6 KiB
Matlab

%input = 15.7; % lif 100Hz
%input = 8.3; % lif 10Hz
trials = 10;
tmax = 50.0;
Dnoise = 1.0;
imax = 25.0;
ithresh = 10.0;
slope=0.2;
% inputs = 0:2:30;
% rates = zeros( size( inputs ) );
% for j = 1:length( inputs )
% input = inputs(j);
% spikes = lifboltzmanspikes( trials, input, tmax, Dnoise, imax, ithresh, slope );
% nspikes = 0;
% for k = 1:length( spikes )
% nspikes = nspikes + length( spikes{k} );
% end
% rate = nspikes/tmax/length( spikes );
% rates(j) = rate;
% end
% plot( inputs, rates );
% grid on;
% return
input = 10.0; % 80 Hz
window = 0.2;
slopes = 0.1:0.1:2.0;
pmax = zeros( size( slopes) );
for j = 1:length( slopes )
slope = slopes( j );
spikes = lifboltzmanspikes( trials, input, tmax, Dnoise, imax, ithresh, slope );
[ n1, bins1 ] = counthist( spikes, w );
spikes = lifboltzmanspikes( trials, input+1.0, tmax, Dnoise, imax, ithresh, slope );
[ n2, bins2 ] = counthist( spikes, w );
subplot( 2, 1, 1 );
bar( bins1, n1, 'b' );
hold on;
bar( bins2, n2, 'r' );
hold off;
subplot( 2, 1, 2 );
bmax = max( [ length( bins1 ), length( bins2 ) ] );
decision1 = zeros( bmax, 1 );
decision2 = zeros( bmax, 1 );
cs1 = ones( bmax, 1 );
cs1(1:length(n1)) = cumsum( n1 );
cs2 = ones( bmax, 1 );
cs2(1:length(n2)) = cumsum( n2 );
cbins = 0:1:bmax-1;
plot( cbins, cs1, 'b' );
hold on;
plot( cbins, cs2, 'r' );
plot( cbins, cs1-cs2, 'g' );
hold off;
pause( 0.1 );
pmax(j) = max( cs1-cs2 );
end
clf;
subplot( 1, 1, 1 );
plot( slopes, pmax );