     yTicks: 5
     click: (x, y) -> initSoliton(x, y) 
 
-# Initial soliton plot
-count = 0
-u0 = null
+@kdv = new $blab.BasicAnimation
+    numSnapshots: 2000
+    delay: 10
+    strobeInterval: 10000
+    snapshotFunction: ->
+    strobeFunction: ->
+
+# Plot control
+count = 0 # number of solitons in plot
+u0 = null # initial condition
 initSoliton = (xS, yS) ->
-    $blab.stopAnimation()
+    @kdv.stopAnimation()
     count++
-    u0 = zeros(x) if count is 1
+    if count is 1
+        u0 = zeros(x)
+        @kdv.n = 0
     x1 = -xS
     A = sqrt(yS/3)
     u0 += soliton(A, x1)

soliton = (A, x1) ->
    3*A.pow(2) * (sech(.5*A*(x+x1))).pow(2)
    
# Soliton graph (LineChart imported from another blab - see "Ext" section)
lineChart = new $blab.LineChart
    id: "solitons"
    xLabel: "x"


# Set up grid
N = 256
dt = 0.4/N.pow(2)  # 0.4 in Trefethen
x = 2*pi/N * linspace(-N/2, N/2-1, N)

# Integrating factor
