File: implic.hoc

package info (click to toggle)
neuron 8.2.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 34,768 kB
  • sloc: cpp: 149,571; python: 58,449; ansic: 50,329; sh: 3,510; xml: 213; pascal: 51; makefile: 35; sed: 5
file content (70 lines) | stat: -rwxr-xr-x 959 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/* Comparison of implicit and crank-nicholson */
/* showing that C-N can have error oscillations */

/* lambda = sqrt(1e4/4 * diam / (Ra * gl)) microns */
/* tau    =  1e-3 * cm / gl msec */

// physical properties of the cell
create a
{access a nseg = 21}

double vt[nseg], vt1[nseg]

// graphical interface appearance
length = 8
objref g
g = new Graph()
g.size(0,length,-.6,1)
proc label() {
	g.vfixed(1)
	g.label(.315,.01, "x (Lambda)")
	g.label(.0,.4, "V")
}
label()
// simulation control
proc init() {
	geometry() membrane()
	v = 0
	v(.5)=1 plotvolt()
}
proc geometry() { local i
	L = length
	diam = 1
	Ra = 1e7/4
}

proc membrane() { local i
	insert pas
	g_pas = .001
	e_pas = 0
}

proc plotvolt() { local x, i
	g.beginline()
	for (x) {
		g.line(x*length, v(x))
	}
	g.flush()
}
proc run() {
	init()
	dt = 1
	g.color($1)
	fadvance() plotvolt() fadvance() plotvolt()
	g.flush()
}
// run simulation
{secondorder=0 run(1) secondorder=2 run(2)}