objref g
g = new Graph()
func ancab() {	local X, T, coef, temp1, temp2
	/* equation 3.24 of Jack, Noble, Tsien */
	/* analytical v of infinite cable due to current injection */
	/* args are X, T , ra*I*lambda*/
	X=$1  T=$2  coef=$3
	if (T <= 0 || X < 0) return 0
	temp1 = sqrt(T)
	temp2 = X/(2*temp1)

	return coef/4*(exp(-X)*erfc(temp2 - temp1) - exp(X)*erfc(temp2 + temp1))
}

proc pancab() {local x	/* Figure 3.4 */
	g.size(0,3,0,1)
	for (x=0; x<2.1; x=x+.5) {
		g.beginline()
		for (t=0; t < 3-1e-9; t=t+dt) {
			g.line(t, ancab(x, t, 2))
		}
		strdef s
		g.fixed(1)
		sprint(s, "X=%g", x)
		g.label(t,ancab(x,t,2),s)
	}
	g.flush()
}

pancab()
