[projects] solution for activation curve
This commit is contained in:
parent
1076145ba1
commit
1362b39fd6
@ -23,6 +23,7 @@ Projects
|
||||
|
||||
1) project_activation_curve
|
||||
medium
|
||||
also normalize activation curve to maximum.
|
||||
|
||||
2) project_adaptation_fit
|
||||
OK, medium
|
||||
|
16
projects/project_activation_curve/solution/ivcurve.m
Normal file
16
projects/project_activation_curve/solution/ivcurve.m
Normal file
@ -0,0 +1,16 @@
|
||||
function [vsteps, peakcurrents] = ivcurve(vsteps, time, currents, tmax)
|
||||
|
||||
peakcurrents = zeros(1, length(vsteps));
|
||||
for k = 1:length(peakcurrents)
|
||||
c = currents((time>0.0)&(time<tmax), k);
|
||||
minc = min(c);
|
||||
maxc = max(c);
|
||||
if abs(minc) > maxc
|
||||
peakcurrents(k) = minc;
|
||||
else
|
||||
peakcurrents(k) = maxc;
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
50
projects/project_activation_curve/solution/main.m
Normal file
50
projects/project_activation_curve/solution/main.m
Normal file
@ -0,0 +1,50 @@
|
||||
%% plot data:
|
||||
x = load('../data/WT_01.mat');
|
||||
wtdata = x.data;
|
||||
plotcurrents(wtdata.t, wtdata.I);
|
||||
|
||||
x = load('../data/A1622D_01.mat');
|
||||
addata = x.data;
|
||||
plotcurrents(addata.t, addata.I);
|
||||
|
||||
%% I-V curve:
|
||||
[wtsteps, wtpeaks] = ivcurve(wtdata.steps, wtdata.t, wtdata.I, 100.0);
|
||||
|
||||
[adsteps, adpeaks] = ivcurve(addata.steps, addata.t, addata.I, 100.0);
|
||||
|
||||
figure();
|
||||
plot(wtsteps, wtpeaks, '-b');
|
||||
hold on;
|
||||
plot(adsteps, adpeaks, '-r');
|
||||
hold off;
|
||||
|
||||
%% reversal potential:
|
||||
wtE = reversalpotential(wtsteps, wtpeaks);
|
||||
adE = reversalpotential(adsteps, adpeaks);
|
||||
|
||||
%% activation curve:
|
||||
wtg = wtpeaks./(wtsteps - wtE);
|
||||
adg = adpeaks./(adsteps - adE);
|
||||
|
||||
wtinfty = wtg(wtsteps<40.0)/mean(wtg((wtsteps>=20.0)&(wtsteps<=40.0)));
|
||||
adinfty = adg(adsteps<40.0)/mean(adg((adsteps>=20.0)&(adsteps<=40.0)));
|
||||
wtsteps = wtsteps(wtsteps<40.0);
|
||||
adsteps = adsteps(adsteps<40.0);
|
||||
|
||||
figure();
|
||||
plot(wtsteps, wtinfty, '-b');
|
||||
hold on;
|
||||
plot(adsteps, adinfty, '-r');
|
||||
|
||||
%% boltzmann fit:
|
||||
bf = @(p, v) 1.0./(1.0+exp(-p(1)*(v - p(2))));
|
||||
p = lsqcurvefit(bf, [1.0, -40.0], wtsteps, wtinfty);
|
||||
wtfit = bf(p, wtsteps);
|
||||
p = lsqcurvefit(bf, [1.0, -40.0], adsteps, adinfty);
|
||||
adfit = bf(p, adsteps);
|
||||
|
||||
plot(wtsteps, wtfit, '-b');
|
||||
plot(wtsteps, adfit, '-r');
|
||||
hold off;
|
||||
|
||||
|
13
projects/project_activation_curve/solution/plotcurrents.m
Normal file
13
projects/project_activation_curve/solution/plotcurrents.m
Normal file
@ -0,0 +1,13 @@
|
||||
function plotcurrents(time, currents)
|
||||
|
||||
figure();
|
||||
hold on;
|
||||
for k = 1:size(currents, 2)
|
||||
plot(time, currents(:, k))
|
||||
end
|
||||
hold off;
|
||||
xlabel('Time [ms]')
|
||||
ylabel('Current')
|
||||
|
||||
end
|
||||
|
@ -0,0 +1,4 @@
|
||||
function E = reversalpotential(vsteps, currents)
|
||||
p = polyfit(vsteps((vsteps>=20.0)&(vsteps<50.0)), currents((vsteps>=20.0)&(vsteps<50.0)), 1);
|
||||
E = -p(2)/p(1);
|
||||
end
|
Reference in New Issue
Block a user