finished fano tim eproject
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
%% general settings for the model neuron:
|
||||
trials = 10;
|
||||
tmax = 50.0;
|
||||
D = 0.01;
|
||||
|
||||
%% generate and plot spiketrains for two inputs:
|
||||
I1 = 14.0;
|
||||
I2 = 15.0;
|
||||
spikes1 = lifspikes(trials, I1, tmax, D);
|
||||
spikes2 = lifspikes(trials, I2, tmax, D);
|
||||
spikes1 = lifspikes(trials, I1, tmax);
|
||||
spikes2 = lifspikes(trials, I2, tmax);
|
||||
subplot(1, 2, 1);
|
||||
tmin = 10.0;
|
||||
spikeraster(spikes1, tmin, tmin+2.0);
|
||||
@@ -18,7 +17,7 @@ title(sprintf('I_2=%g', I2))
|
||||
%savefigpdf(gcf(), 'spikeraster.pdf')
|
||||
|
||||
%% spike count histograms:
|
||||
Ts = [0.01 0.1 0.5 1.0];
|
||||
Ts = [0.01 0.1 0.3 1.0];
|
||||
cmax = 100;
|
||||
figure()
|
||||
for k = 1:length(Ts)
|
||||
@@ -36,7 +35,7 @@ end
|
||||
|
||||
%% discrimination measure:
|
||||
T = 0.1;
|
||||
cmax = 20;
|
||||
cmax = 15;
|
||||
[d, thresholds, true1s, false1s, true2s, false2s, pratio] = discriminability(spikes1, spikes2, tmax, T, cmax);
|
||||
figure()
|
||||
subplot(1, 3, 1);
|
||||
@@ -45,6 +44,7 @@ hold on;
|
||||
plot(thresholds, true2s, 'b');
|
||||
plot(thresholds, false1s, 'r');
|
||||
plot(thresholds, false2s, 'r');
|
||||
xlim([0 cmax])
|
||||
hold off;
|
||||
% Ratio:
|
||||
subplot(1, 3, 2);
|
||||
@@ -57,7 +57,7 @@ plot(false2s, true1s);
|
||||
%% discriminability:
|
||||
Ts = 0.01:0.01:1.0;
|
||||
cmax = 100;
|
||||
ds = zeros(length(Ts), 1)
|
||||
ds = zeros(length(Ts), 1);
|
||||
for k = 1:length(Ts)
|
||||
T = Ts(k);
|
||||
[c1, b1] = counthist(spikes1, 0.0, tmax, T, cmax);
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
function spikes = lifspikes(trials, input, tmaxdt, D)
|
||||
function spikes = lifspikes(trials, input, tmax)
|
||||
% Generate spike times of a leaky integrate-and-fire neuron.
|
||||
% trials: the number of trials to be generated
|
||||
% input: the stimulus either as a single value or as a vector
|
||||
% tmaxdt: in case of a single value stimulus the duration of a trial
|
||||
% in case of a vector as a stimulus the time step
|
||||
% input: the stimulus intensity
|
||||
% tmax: the duration of a trial
|
||||
% D: the strength of additive white noise
|
||||
|
||||
tau = 0.01;
|
||||
@@ -12,21 +11,18 @@ function spikes = lifspikes(trials, input, tmaxdt, D)
|
||||
end
|
||||
vreset = 0.0;
|
||||
vthresh = 10.0;
|
||||
D = 0.01;
|
||||
dt = 5e-5;
|
||||
|
||||
if max(size(input)) == 1
|
||||
input = input * ones(ceil(tmaxdt/dt), 1);
|
||||
else
|
||||
dt = tmaxdt;
|
||||
end
|
||||
n = ceil(tmax/dt);
|
||||
spikes = cell(trials, 1);
|
||||
for k=1:trials
|
||||
times = [];
|
||||
j = 1;
|
||||
v = vreset + (vthresh-vreset)*rand(1);
|
||||
noise = sqrt(2.0*D)*randn(length(input), 1)/sqrt(dt);
|
||||
noise = sqrt(2.0*D)*randn(n, 1)/sqrt(dt);
|
||||
for i=1:length(noise)
|
||||
v = v + (- v + noise(i) + input(i))*dt/tau;
|
||||
v = v + (- v + noise(i) + input)*dt/tau;
|
||||
if v >= vthresh
|
||||
v = vreset;
|
||||
spiketime = i*dt;
|
||||
|
||||
Reference in New Issue
Block a user