Simulating the model
Subsections

Simulating the model

Now that the model is set up we turn to the issue how to define the input and simulate the network with these inputs.

Setting up the input

As we have three input neurons (2 spiking one analog) we have to define a stimulus which consists of three channels (2 spiking one analog). The stimulus can be defined as follows:

% create empty structure
S = empty_stimulus('nChannels',3,'Tstim',1);  

% fill channel 1 with some spikes
S.channel(1).data    = 1*rand(1,10);
S.channel(1).spiking = 1;

% fill channel 2 with some spikes
S.channel(2).data    = 1*rand(1,20);
S.channel(2).spiking = 1;

% channel 3 is a sine wave
S.channel(3).dt      = 0.005;
S.channel(3).data    = 1+sin(2*pi*10*[0:S.channel(3).dt:1]);
S.channel(3).spiking = 0;

Note that each signal/channel can be either spiking ( S.channel(i).spiking=1) or analog (S.channel(i).spiking=0). In the later case one has to specify the temporal resolution ( S.channel(i).dt) of the signal.

We adopt the convention that the first channel of the stimulus is assigned to the first input neuron created by means of [nmc,p]=add(nmc,'pool',... statements. Keep this convention in mind when setting up the stimulus otherwise you may be surprised by error messages or strange results (if the input neurons have different connections to the rest of the network).

You can use the command

>> plot_stimulus(S);
to plot the stimulus defined above. This results in the plot shown in Figure [*].
Figure 6: A stimulus with 2 spiking and one ananlog channel.

\includegraphics[height=8cm]{tut_stim}

Defining the respones

Obviously we want to see how the network responses to the given stimulus. Therefor we must specify what we want to record during the stimulation. The following code fragment shows how to record the spikes of the pool of LifNeurons and the membrane voltage of a certain subset (defined by specifiyng the appropriate volume) of the SigmoidalNeuron and HHNeuron pool.

>> nmc = record(nmc,'Pool',p_lif,'Field','spikes');
>> nmc = record(nmc,'Volume',[6 1 1; 8 3 1],'Field','Vm');
>> nmc = record(nmc,'Volume',[10 1 1; 12 3 1],'Field','Vm');

Running the simulation

Now we are ready to run the simulation; lets say for 1sec.

>> R=simulate(nmc,1,S);
This returns the cell array R which contains the response of the network. See the section about input and output for more details about the structure of R.

However, one can use the command

>> plot_response(R);
to plot the response R. This results in the plot shown in Figure [*].
Figure 7: Response.

\includegraphics[height=8cm]{tut_resp}

 
(C) 2003, Thomas Natschläger last modified 06/12/2006