function [Inter,Knots,numb_cells,n_fun_over,n_fun,weights,disp_matrix]=create_CMAC(min,max,num_knot,gener,disp); % [Knots,numb_cells,n_fun_over,n_fun,weights,disp_matrix]=create_CMAC(min,max,num_knot,gener,disp) % % This function creates a CMAC neural network assuming % that the minimum value of the input vector is stored in vector % min, the maximum value of the input vector is stored in vector max, % the number of internal knots is stored in vector num_knots, % and the generalization parameter is gener. Disp is the displacement vector % for the first overlay % It is assumed that the interior knots are equidistantly distributed % and that binary CMACs, with active functions with the value of % 1/gener are employed. % % Output parameters: % % Knots - matrix where the knots in ecah input dimension are stored % by row % % numb_cells - total number of cells in the network % % n_fun_over - number of basis functions per overlay % % n_fun - number of basis functions for the newtork % % weights - vector of weights in the network % ndim=length(min); % compute the displacement matrix disp_matrix=disp; for i=1:gener-1 for j=1:ndim disp_matrix(j,i+1)=mod((i+1)*disp_matrix(j,1),gener); if disp_matrix(j,i+1)==0 disp_matrix(j,i+1)=gener; end end end for i=1:ndim delta_x=max(i)-min(i); delta=delta_x/(num_knot(i)+1); Inter(i,1:num_knot(i)+2)=[min(i):delta: max(i)]; Knots(i,1:num_knot(i))=Inter(i,2:num_knot(i)+1); for j=1:gener sup(i,j)=ceil((num_knot(i)+1-disp_matrix(i,j))/gener)+1; end end n_fun_over=prod(sup,1); n_fun=sum(n_fun_over); numb_cells=prod(num_knot+1); weights=zeros(n_fun,1);