Home > TNNT_1_07 > @theta_neuron > run_neuron.m

run_neuron

PURPOSE ^

RUN_NEURON calculates the firing behavior of a single theta neuron

SYNOPSIS ^

function [ts, Theta, Y, Z, thm, thp] = run_neuron(Neuron, ti, Weights, Delays, SimulationMethod, TimeStep, GradFlag, Verbose)

DESCRIPTION ^

RUN_NEURON calculates the firing behavior of a single theta neuron

Description: 
Calculates the firing behavior of a single theta neuron with n input 
synapses and q input spikes. q=n for SISO in which there is exactly one 
spike per synapse. Likewise, there are r output spikes. There will be at
most one output spike after the last input spike, depending on the neuron 
phase and the sign of the baseline current, Io.

Syntax:
RUN_NEURON(Neuron, ti, Weights, Delays, SimulationMethod);
RUN_NEURON(..., [TimeStep], [GradFlag], [Verbose]);
[ts, Theta, Y, Z, thm, thp] = RUN_NEURON(...);

Input Parameters:
o Neuron: An object of the neuron class
o ti: A qx2 array that contains the neuron indices (values between 1 and n inclusive) 
    for each spike time (column 1) and the input spike times (column 2)
o Weights: An nx1 array indicating the weights of the n input synapses
o Delays: An nx1 array indicating the delays of the n input synapses
o SimulationMethod: A string that determines which method will be used
    to calculate the output spike firing times.  Possible values are
    "Numerical" or "Event-Driven".
o TimeStep: Optional positive scalar for use in numerical integration. The default value 
    is 0.001.
o GradFlag: Optional boolean flag to indicate whether the gradient matrices Y and Z 
    should be calculated.  If the flag is 0, then -1 is returned for Y and Z.
    The default value is 1.
o Verbose: Optional flag to indicate if extra information will be
    displayed on the screen. A value of 0 displays no additional information (this is 
    the default value), while a value of 1 displays all information.  Values greater 
    than 1 display partial information. See Verbose for more details.

Output Parameters:
o ts: An rx1 array of the output firing times, returns an empty array if no
    output spikes occur
o Theta: An array of size 2+ts(end)/TimeStep. If numerical integration is used, the 
    complete trajectory of the phase is returned.  For event-driven simulation, -1 
    is returned (since the trajectory is not calculated).
o Y: An nxr matrix of the effect of each synapse n on output spike r, used
     in network training
o Z: A qxr matrix of the effect of each input spike q on output spike r,
     used in network training
o thm: A qx1 array of phase values directly before each input spike
o thp: A qx1 array of phase values directly after each input spike

Examples:
>> N=theta_neuron;
>> [ts, Theta] = run_neuron(N, [1 3; 2 4; 1 2], 0.01*rand(1,3), zeros(1,3),'Numerical');
>> figure;
>> plot(0.001*(1:length(Theta)),Theta,ts,zeros(1,length(ts)),'o');
>> xlabel('Time (ms)'); ylabel('Phase'); grid on;

>> N=theta_neuron('Io',0.1);
>> [ts, Theta] = run_neuron(N, [1 3; 2 50], 0.01*rand(1,2), zeros(1,2),'Numerical');
>> figure;
>> plot(0.001*(1:length(Theta)),Theta,ts,zeros(1,length(ts)),'o');
>> xlabel('Time (ms)'); ylabel('Phase'); grid on;

See also theta_neuron, verbose

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ts, Theta, Y, Z, thm, thp] = run_neuron(Neuron, ti, Weights, Delays, SimulationMethod, TimeStep, GradFlag, Verbose)
0002 %RUN_NEURON calculates the firing behavior of a single theta neuron
0003 %
0004 %Description:
0005 %Calculates the firing behavior of a single theta neuron with n input
0006 %synapses and q input spikes. q=n for SISO in which there is exactly one
0007 %spike per synapse. Likewise, there are r output spikes. There will be at
0008 %most one output spike after the last input spike, depending on the neuron
0009 %phase and the sign of the baseline current, Io.
0010 %
0011 %Syntax:
0012 %RUN_NEURON(Neuron, ti, Weights, Delays, SimulationMethod);
0013 %RUN_NEURON(..., [TimeStep], [GradFlag], [Verbose]);
0014 %[ts, Theta, Y, Z, thm, thp] = RUN_NEURON(...);
0015 %
0016 %Input Parameters:
0017 %o Neuron: An object of the neuron class
0018 %o ti: A qx2 array that contains the neuron indices (values between 1 and n inclusive)
0019 %    for each spike time (column 1) and the input spike times (column 2)
0020 %o Weights: An nx1 array indicating the weights of the n input synapses
0021 %o Delays: An nx1 array indicating the delays of the n input synapses
0022 %o SimulationMethod: A string that determines which method will be used
0023 %    to calculate the output spike firing times.  Possible values are
0024 %    "Numerical" or "Event-Driven".
0025 %o TimeStep: Optional positive scalar for use in numerical integration. The default value
0026 %    is 0.001.
0027 %o GradFlag: Optional boolean flag to indicate whether the gradient matrices Y and Z
0028 %    should be calculated.  If the flag is 0, then -1 is returned for Y and Z.
0029 %    The default value is 1.
0030 %o Verbose: Optional flag to indicate if extra information will be
0031 %    displayed on the screen. A value of 0 displays no additional information (this is
0032 %    the default value), while a value of 1 displays all information.  Values greater
0033 %    than 1 display partial information. See Verbose for more details.
0034 %
0035 %Output Parameters:
0036 %o ts: An rx1 array of the output firing times, returns an empty array if no
0037 %    output spikes occur
0038 %o Theta: An array of size 2+ts(end)/TimeStep. If numerical integration is used, the
0039 %    complete trajectory of the phase is returned.  For event-driven simulation, -1
0040 %    is returned (since the trajectory is not calculated).
0041 %o Y: An nxr matrix of the effect of each synapse n on output spike r, used
0042 %     in network training
0043 %o Z: A qxr matrix of the effect of each input spike q on output spike r,
0044 %     used in network training
0045 %o thm: A qx1 array of phase values directly before each input spike
0046 %o thp: A qx1 array of phase values directly after each input spike
0047 %
0048 %Examples:
0049 %>> N=theta_neuron;
0050 %>> [ts, Theta] = run_neuron(N, [1 3; 2 4; 1 2], 0.01*rand(1,3), zeros(1,3),'Numerical');
0051 %>> figure;
0052 %>> plot(0.001*(1:length(Theta)),Theta,ts,zeros(1,length(ts)),'o');
0053 %>> xlabel('Time (ms)'); ylabel('Phase'); grid on;
0054 %
0055 %>> N=theta_neuron('Io',0.1);
0056 %>> [ts, Theta] = run_neuron(N, [1 3; 2 50], 0.01*rand(1,2), zeros(1,2),'Numerical');
0057 %>> figure;
0058 %>> plot(0.001*(1:length(Theta)),Theta,ts,zeros(1,length(ts)),'o');
0059 %>> xlabel('Time (ms)'); ylabel('Phase'); grid on;
0060 %
0061 %See also theta_neuron, verbose
0062 
0063 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0064 
0065 
0066 %Error handling for input arguments
0067 if nargin<5
0068     disp('Error in run_neuron!!! Not enough input arguements');
0069     disp(['Needed at least 5 inputs but only got ' num2str(nargin)]);
0070     return;
0071 end
0072 if (nargin < 6)
0073     TimeStep=0.001;
0074 end
0075 if (nargin < 7)
0076     GradFlag=1;
0077 end
0078 if (nargin < 8)
0079     Verbose=0;
0080 end
0081 
0082 %Initialize return parameters to error return values
0083 Theta=-1; ts=[]; Y=-1; Z=-1; thm=-1; thp=-1;
0084 
0085 %Create the Network
0086 NumInputs=max(ti(:,1));
0087 NeuronIndex=NumInputs+1;
0088 ThNN=theta_neuron_network('Io',Neuron.Io,'Alpha',Neuron.Alpha,'TimeStep',TimeStep,'SimulationMethod',SimulationMethod,...
0089     'StructureFormat',{'LayerArray',[NumInputs 1]});
0090 ThNN.Weights(1:NumInputs,NeuronIndex)=Weights(1:NumInputs); %Ignores extra weights
0091 ThNN.Delays(1:NumInputs,NeuronIndex)=Delays(1:NumInputs); %Ignores extra delays
0092 
0093 %Run the Network
0094 [Theta, ts, Y, Z, thm, thp] = run_networked_neuron(ThNN, ti, NeuronIndex, GradFlag, Verbose);
0095 
0096 return;

Generated on Wed 02-Apr-2008 15:16:32 by m2html © 2003