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/projects/project_ficurves/solution/main.m

37 lines
960 B
Matlab

%% solution for project onset-FI
clear all
close all
dt = 1./20000;
t_min = -0.2;
t_max = 1.825;
data_folder = strcat('..', filesep, 'data');
files = dir(strcat(data_folder, filesep, '*.mat'));
contrasts = zeros(length(files), 1);
rates = {};
for i = 1:length(files)
data = load(strcat(data_folder, filesep, files(i).name));
contrasts(i) = data.contrast;
spikes_times = data.spike_times;
[t, rates{i}] = getFiringRates(spikes_times, t_min, t_max, dt);
end
%% create a plot of the average response for the different contrasts
plotAverageResponse(rates, t, contrasts, 'averageResponse')
%% extract the onset and the steady-state firing rate
[fi, fi_std, contr] = getFICurve(rates, t, 0.015, contrasts);
%% plot FI curve
plotFICurve(fi, fi_std, contr, 'ficurve')
%% fit FICurve with Boltzmann function
best_params = boltzmannFit(contr, fi);
% plot the fi curve with the fit
plotFICurveFit(fi, fi_std, contr, best_params, 'ficurvefit')