Purpose: This demo implements a controlled two-dimensional oscillator.
Comments: This is functionally the analogous to the controlled integrator, but in a 2-D space. The available slider allows the frequency to be directly controlled, to be negative or positive. This behavior maps directly to the differential equation used to describe a simple harmonic oscillator (i.e. where A = [0 freq; -freq, 0]). The control in this circuit changes the freq variable in that equation.
Usage: When you run this demo, it will automatically put in a step function on the input to start the oscillator moving. You can see where it is in phase space in the XY plot (if you want to see that over time, right-click on the Oscillator population and select X->value). You can change the frequency of rotation by moving the visible slider. Positive values rotate clockwise and negative values counter-clockwise.
Output: See the screen capture below
import nef speed=10 #Base frequency of oscillation tau=0.1 #Recurrent time constant net = nef.Network('Controlled Oscillator') #Make controllable inputs net.make_input('Start', [1,0], zero_after_time=0.15) #Kick it to get it going net.make_input('Speed', ) #Control the speed interactively #Make two populations, one for freq control, and one the oscillator net.make('Oscillator', 500, 3, radius=1.7) net.make('SpeedNeurons', 100, 1) #Connect the elements of the network net.connect('Start', 'Oscillator', index_post=[0,1]) net.connect('Speed', 'SpeedNeurons') net.connect('SpeedNeurons', 'Oscillator', index_post=) #Define the nonlinear interactions in the state space of the oscillator def controlled_path(x): return x+x*speed*tau*x, x-x*speed*tau*x, 0 net.connect('Oscillator', 'Oscillator', func=controlled_path, pstc=tau) net.add_to_nengo()