% Derrick Roos % % pattern_maker.m - creates a pattern matrix. Each row represents a % pattern with 1's for active cells, 0's for inactive cells. % % pattern = pattern_maker(n_cells,n_patterns,n_active) % where: n_cells = number of cells % n_pattern = number of patterns % n_active = number active units per pattern % % output: pattern = n_patterns x n_cells matrix with each row a % randomized pattern with n_active units function pattern = pattern_maker(n_cells,n_patterns,n_active) for i=1:n_patterns cells = ceil(n_cells*rand(n_active,1)); base = zeros(1,n_cells); base(cells) = 1; pattern(i,1:n_cells) = base; end