How can I calculate the Euclidean distance? and to do this, how do I determine a graph as a variable

1 view (last 30 days)
This is the code used to calculate different spike patterns changing gKmax and gNamax, how do i calculate the distance when the values are changed?
function [ time m h n v ]= finished(gKmax,gNamax) % returns the voltage of a HH neuron model in v % t is atime vector % m is the sodium activation % delta_t is the timestep % external current % number of iterations Iext=0.6; membrane_capacitance=0.01; delta_t=0.001; n_iteration=100000; %constant values ENa=-55.17-60; EK=+72.14-60; El=-10.58;
%maximum conductances
gLmax=0.003;
%initial conditions vm(1)=0; %membrane voltage to begin with v(1)=vm;
%alpha and beta values alpha_n=0.01*(vm+10)/(exp((vm+10)/10)-1); beta_n=0.125*exp(vm/80); alpha_m=0.1*(vm+25)/(exp((vm+25/10))-1); beta_m=4*exp(vm/18); alpha_h=0.07*exp(vm/20); beta_h=1/(exp(vm+30/10)+1);
%starting values for n m and h infinity_n=alpha_n/(alpha_n+beta_n); infinity_m=alpha_m/(alpha_m+beta_m); infinity_h=alpha_h/(alpha_h+beta_h);
% loop for calculation for i=1:n_iteration,
delta_m=delta_t*(alpha_m*(1-infinity_m)-beta_m*infinity_m);
delta_n = delta_t*(alpha_n*(1-infinity_n)-beta_n*infinity_n);
delta_h = delta_t*(alpha_h*(1-infinity_h)-beta_h*infinity_h);
infinity_m = infinity_m + delta_m;
infinity_n = infinity_n + delta_n;
infinity_h = infinity_h + delta_h;
gNa = gNamax*infinity_m^3*infinity_h;
gK = gKmax*infinity_n^4;
gL = gLmax;
INa = gNa*(vm-ENa);
IK = gK*(vm-EK);
Il = gL*(vm-El);
dvm = (delta_t/membrane_capacitance)*(-Iext-( INa + IK + Il));
vm = vm + dvm;
v(i+1) = vm;
m(i+1)= infinity_m;
h(i+1)= infinity_h;
n(i+1)= infinity_n;
alpha_n=0.01*(vm+10)/(exp((vm+10)/10)-1); beta_n=0.125*exp(vm/80); alpha_m=0.1*(vm+25)/(exp((vm+25)/10)-1); beta_m=4*exp(vm/18); alpha_h=0.07*exp(vm/20); beta_h=1/(1+exp(0.1*(vm+30))); end v= -v-60;
time = delta_t*(1:n_iteration+1);
  4 Comments
dpb
dpb on 28 Aug 2013
At the little blue circle w/ the "?" in it and the "Help" word beside it, maybe???
Please correct spelling of "Euclidean" -- tags won't be of any value misspelled in particular.
Jan
Jan on 29 Aug 2013
Edited: Jan on 29 Aug 2013
@Helen: It appears on top of the input dialog field when you insert a new message or editing an existing one. It is on the right of the buttons, which can be used for formatting: [B], [I], [Aa], [Link-icon], etc. The topic of formatting in the forum has been discussed such often, that you can surely find it by using the Search field also.
It is frustrating, that TMW hesitates to present e.g. http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup for newcomers automatically, but let the contributor explain this every day again and again.

Sign in to comment.

Answers (0)

Categories

Find more on Neural Simulation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!