Home > TNNT_1_07 > @theta_neuron > theta_neuron.m

theta_neuron

PURPOSE ^

THETA_NEURON constructs a theta neuron object

SYNOPSIS ^

function ThetaNeuron = theta_neuron(varargin)

DESCRIPTION ^

THETA_NEURON constructs a theta neuron object

Description:
This function constructs theta neuron object, either a single object
or an array of objects.  Inputs, all of which are optional, follow a
Name/Value format. Any invalid inputs cause -1 to be returned.

Syntax:
ThetaNeuron = THETA_NEURON('PropertyName',PropertyValue,...);

Input Parameters:
o Alpha: Scalar scaling constant. The default value is 1.
o Io: Scalar baseline current. The default value is -0.005.
o InitialPhaseMethod: A cell of size 1x2 or 1x1 that indicates the phase
    initialization method. Possible Values are:
      {'PositiveFixedPoint'}
      {'NegativeFixedPoint'}
      {'PositiveFixedPointDelta' Delta}
      {'NegativeFixedPointDelta' Delta}
      {'GivenValue' Value}  
    When Io>0, the default is a GivenValue of 0. When Io<0, the default
    is a PositiveFixedPointDelta of 1e-4.
o Size: The one or two dimensional size of the neuron array with
    alternative syntax to indicate that the neurons in the array are 
    empty. For example, [2 4] or {'Null' [5]}. The default size is a
    single neuron.

Output Parameter:
o ThetaNeuron: A theta neuron object, or array of theta neuron objects.
    These neurons can be used to manually build a theta neuron network 
    or can be run individually in run_neuron

Examples:
>> N1=theta_neuron;

>> N2=theta_neuron('Size', [3], 'InitialPhaseMethod',{'PositiveFixedPointDelta',1e-4});

See also:
    theta_neuron_network
    theta_neuron/display
    theta_neuron/run_neuron
    theta_neuron/subsasgn
    theta_neuron/subsref

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ThetaNeuron = theta_neuron(varargin)
0002 %THETA_NEURON constructs a theta neuron object
0003 %
0004 %Description:
0005 %This function constructs theta neuron object, either a single object
0006 %or an array of objects.  Inputs, all of which are optional, follow a
0007 %Name/Value format. Any invalid inputs cause -1 to be returned.
0008 %
0009 %Syntax:
0010 %ThetaNeuron = THETA_NEURON('PropertyName',PropertyValue,...);
0011 %
0012 %Input Parameters:
0013 %o Alpha: Scalar scaling constant. The default value is 1.
0014 %o Io: Scalar baseline current. The default value is -0.005.
0015 %o InitialPhaseMethod: A cell of size 1x2 or 1x1 that indicates the phase
0016 %    initialization method. Possible Values are:
0017 %      {'PositiveFixedPoint'}
0018 %      {'NegativeFixedPoint'}
0019 %      {'PositiveFixedPointDelta' Delta}
0020 %      {'NegativeFixedPointDelta' Delta}
0021 %      {'GivenValue' Value}
0022 %    When Io>0, the default is a GivenValue of 0. When Io<0, the default
0023 %    is a PositiveFixedPointDelta of 1e-4.
0024 %o Size: The one or two dimensional size of the neuron array with
0025 %    alternative syntax to indicate that the neurons in the array are
0026 %    empty. For example, [2 4] or {'Null' [5]}. The default size is a
0027 %    single neuron.
0028 %
0029 %Output Parameter:
0030 %o ThetaNeuron: A theta neuron object, or array of theta neuron objects.
0031 %    These neurons can be used to manually build a theta neuron network
0032 %    or can be run individually in run_neuron
0033 %
0034 %Examples:
0035 %>> N1=theta_neuron;
0036 %
0037 %>> N2=theta_neuron('Size', [3], 'InitialPhaseMethod',{'PositiveFixedPointDelta',1e-4});
0038 %
0039 %See also:
0040 %    theta_neuron_network
0041 %    theta_neuron/display
0042 %    theta_neuron/run_neuron
0043 %    theta_neuron/subsasgn
0044 %    theta_neuron/subsref
0045 
0046 %Copyright (C) 2008 Sam McKennoch <Samuel.McKennoch@loria.fr>
0047 
0048 
0049 %Check to see if formatting is correct
0050 if mod(nargin,2)~=0
0051     disp('Error in theta neuron constructor: There must be an even number of inputs');
0052     ThetaNeuron=-1;
0053     return;
0054 end
0055 
0056 NullFlag=0;
0057 NeuronSize=[1 1];
0058 ProtoNeuron.Alpha=1;
0059 ProtoNeuron.Io=-0.005;
0060 ProtoNeuron.InitialPhaseMethod={};
0061 NeuronFields={'Alpha','Io','InitialPhaseMethod'};
0062 
0063 %Fill in prototype neuron from inputs
0064 %Cycle through inputs and assign naively
0065 SizeFlag=0; %Allow Size to be assigned only once
0066 for j=1:(nargin/2)
0067     switch varargin{2*j-1}
0068         case 'Size'
0069             if SizeFlag
0070                 disp('Warning: Size attempted to be assigned more than once; ignoring...');
0071                 continue;
0072             end
0073             if iscell(varargin{2*j}) && strcmp(varargin{2*j}{1},'Null')
0074                 NullFlag=1;
0075                 NeuronSizeTemp=varargin{2*j}{2};
0076             else
0077                 NeuronSizeTemp=varargin{2*j};
0078             end
0079             if ~isnumeric(NeuronSizeTemp)
0080                 disp('Error in theta neuron constructor: Invalid Size');
0081                 ThetaNeuron=-1;
0082                 return;
0083             end
0084             if numel(NeuronSizeTemp)==1
0085                 NeuronSize(1)=NeuronSizeTemp;
0086             else
0087                 NeuronSize=NeuronSizeTemp;
0088             end
0089             SizeFlag=1;
0090         case NeuronFields
0091             ProtoNeuron.(varargin{2*j-1})=varargin{2*j};
0092         otherwise
0093             disp(['Warning: Value ', varargin{2*j-1}, ' is unknown; ignoring...']);
0094     end
0095 end
0096 
0097 %More type checking
0098 if ~isnumeric(ProtoNeuron.Alpha)
0099     disp('Error in theta neuron constructor: Invalid Alpha');
0100     ThetaNeuron=-1;
0101     return;
0102 end
0103 if ~isnumeric(ProtoNeuron.Io)
0104     disp('Error in theta neuron constructor: Invalid Io');
0105     ThetaNeuron=-1;
0106     return;
0107 end
0108 if ~iscell(ProtoNeuron.InitialPhaseMethod)
0109     disp('Error in theta neuron constructor: Invalid Initial Phase Method');
0110     ThetaNeuron=-1;
0111     return;
0112 end    
0113 
0114 %Fill in calculated values
0115 if isempty(ProtoNeuron.InitialPhaseMethod)
0116     if ProtoNeuron.Io<0
0117         ProtoNeuron.InitialPhaseMethod = {'PositiveFixedPointDelta', 0.0001};
0118     else
0119         ProtoNeuron.InitialPhaseMethod = {'GivenValue', 0};
0120     end
0121 end
0122 ProtoNeuron.Beta=sqrt(abs(ProtoNeuron.Alpha*ProtoNeuron.Io));
0123 
0124 if ProtoNeuron.Io<0
0125     ProtoNeuron.PositiveFixedPoint=real(acos((1+ProtoNeuron.Alpha*ProtoNeuron.Io)/(1-ProtoNeuron.Alpha*ProtoNeuron.Io)));
0126     switch ProtoNeuron.InitialPhaseMethod{1}
0127         case 'PositiveFixedPoint'
0128             ProtoNeuron.Phase=ProtoNeuron.PositiveFixedPoint;
0129         case 'NegativeFixedPoint'
0130             ProtoNeuron.Phase=-ProtoNeuron.PositiveFixedPoint;
0131         case 'PositiveFixedPointDelta'
0132             ProtoNeuron.Phase=ProtoNeuron.PositiveFixedPoint+ProtoNeuron.InitialPhaseMethod{2};
0133         case 'NegativeFixedPointDelta'
0134             ProtoNeuron.Phase=-ProtoNeuron.PositiveFixedPoint+ProtoNeuron.InitialPhaseMethod{2};
0135         case 'GivenValue'
0136             ProtoNeuron.Phase=ProtoNeuron.InitialPhaseMethod{2};
0137         otherwise
0138             disp('Error in theta neuron constructor: Invalid Initial Phase Method');
0139     end
0140 else
0141     ProtoNeuron.PositiveFixedPoint=0;
0142     try
0143         ProtoNeuron.Phase=ProtoNeuron.InitialPhaseMethod{2};
0144     catch
0145         ProtoNeuron.Phase=0;
0146     end
0147 end
0148 
0149 %Handle Null Case
0150 if NullFlag
0151     ProtoNeuron.Alpha=[];
0152     ProtoNeuron.Io=[];
0153     ProtoNeuron.InitialPhaseMethod={'' ''};
0154     ProtoNeuron.Beta=[];
0155     ProtoNeuron.PositiveFixedPoint=[];
0156     ProtoNeuron.Phase=[];
0157 end
0158 
0159 %Arrayerize it...
0160 for j=1:NeuronSize(1)
0161     for k=1:NeuronSize(2)
0162         ThetaNeuron(j,k)=ProtoNeuron;
0163     end
0164 end
0165 ThetaNeuron = class(ThetaNeuron,'theta_neuron');

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