Page 1 of 1

compute nseg

Posted: Thu Aug 22, 2013 2:33 am
by shyam_u2
I don't understand the following line from fixnseg.hoc
nseg = int((L/(d_lambda*lambda_f(freq))+0.9)/2)*2 + 1
I want to set the distance between adjacent nodes to 10% of AC length constant at 100 Hz. For a compartment of length 60 um, diam 3 um, Ra 100 um and cm =1uf/cm2,I get the distance between adjacent nodes to be 488(AC length constant at 100 Hz) *0.1 = 48.8 um. I expect the the same spacing between internal nodes even for longer compartments. But in NEURON, using the function fixnseg.hoc, nseg for the compartment mentioned above for lengths of 60 and 120 um are 3 and 3 respectively which means the spacing between the internal nodes are big in 120 um compartment than in 60 um counterpart. Any reasons?

Re: compute nseg

Posted: Thu Aug 22, 2013 1:24 pm
by ted
nseg needs to be the smallest odd number such that L/nseg is < 0.1*lambda at 100 Hz. Why an odd number? So that there is a node at 0.5. Why should there be a node at 0.5? Because
secname.rangevarname
returns the value of rangevarname at 0.5. If nseg is even, 0.5 lies on the boundary between two adjacent segments, and roundoff error will determine which of these segments is the one whose node is referenced by
secname.rangevarname
It is not a good idea to create situations in which a result is determined by roundoff error.