LTUsimulate - simulates an LTU network for numIter time steps. [output,newStates] = LTUsimulate(LTUnetwork,states,inputs,numIter) simlulates an LTUnetwork with states and input for numIter time steps, returns the new states and the output. LTUnetwork contains the information for connectivity and for which cells in the network are input and output cells; states is a vector containing a state (0 or 1) for each unit; input is the numerical input values into the network; numIter is the number of iterations to be simulated. output is a vector of network outputs (0 or 1); newStates is the new state vector for the network. See also makeLTUsegmentNetwork, LTUsegmentMap, dataStructures.
0001 % LTUsimulate - simulates an LTU network for numIter time steps. 0002 % 0003 % [output,newStates] = LTUsimulate(LTUnetwork,states,inputs,numIter) 0004 % simlulates an LTUnetwork with states and input for numIter 0005 % time steps, returns the new states and the output. 0006 % LTUnetwork contains the information for connectivity and for 0007 % which cells in the network are input and output cells; 0008 % states is a vector containing a state (0 or 1) for each unit; 0009 % input is the numerical input values into the network; 0010 % numIter is the number of iterations to be simulated. 0011 % 0012 % output is a vector of network outputs (0 or 1); 0013 % newStates is the new state vector for the network. 0014 % 0015 % See also makeLTUsegmentNetwork, LTUsegmentMap, dataStructures. 0016 0017 % This file is part of the SaliencyToolbox - Copyright (C) 2006-2007 0018 % by Dirk B. Walther and the California Institute of Technology. 0019 % See the enclosed LICENSE.TXT document for the license agreement. 0020 % More information about this project is available at: 0021 % http://www.saliencytoolbox.net 0022 0023 function [output,newStates] = LTUsimulate(LTUnetwork,states,inputs,numIter) 0024 0025 % do the simulation cycles 0026 for iter = 1:numIter 0027 0028 % set the states of the input units to the input 0029 states(LTUnetwork.input_idx) = inputs; 0030 0031 % compute the activity propagation 0032 prop = states * LTUnetwork.connections; 0033 0034 % apply thresholds 0035 states = double(prop >= LTUnetwork.thresholds); 0036 end 0037 0038 % assign return values 0039 newStates = states; 0040 output = states(LTUnetwork.output_idx);