DiscretizePURPOSEConverts a continuous space into a discrete one.
SYNOPSISfunction DS=Discretize(CS,n,varargin)
DESCRIPTIONConverts a continuous space into a discrete one. Generates a discrete space from a continuous one. The discrete state is generated via sampling (each sample becomes one of the states in the discrete version of the space). Parameters: CS: The continuous space n: The number of samples to generate. The number of states of the output discrete space. samples: [optional] some samples to use in the discretization Outputs: DS: The resulting discrete space. CROSS-REFERENCE INFORMATIONThis function calls:
SOURCE CODE0001 function DS=Discretize(CS,n,varargin) 0002 % Converts a continuous space into a discrete one. 0003 % 0004 % Generates a discrete space from a continuous one. 0005 % The discrete state is generated via sampling (each sample becomes one 0006 % of the states in the discrete version of the space). 0007 % 0008 % Parameters: 0009 % CS: The continuous space 0010 % n: The number of samples to generate. The number of states of the 0011 % output discrete space. 0012 % samples: [optional] some samples to use in the discretization 0013 % 0014 % Outputs: 0015 % DS: The resulting discrete space. 0016 % 0017 0018 if nargin>2 0019 k=size(varargin{1},2); 0020 samples=cell(1,k+n); 0021 samples(1:k)=varargin{1}; 0022 else 0023 k=0; 0024 samples=cell(1,n); 0025 end 0026 0027 for i=1:n 0028 samples{k+i}=rand(CS); 0029 end 0030 0031 DS=DSpace(n+k,samples); |