% This is a single input (x) normalized Radial-Basis Neural Network % The parameter vector theta is used to define the value of the % output. range = [x1, x2] where x1 is the minimum input value and x2 is % the max input. sig is used to describe the width of the basis function function [y, mu] = rbnn(x, range, sig, theta); p = length(theta); theta = theta(:); x1 = range(1); x2 = range(2); % define the centers of the basis functions d = (x2 - x1)/(p-1); xc = (0:(p-1))*d + x1; xc = xc(:); % make sure its a column-vector % define the basis functions dist = (x - xc).^2; mu = exp(-dist/sig^2); mu = mu(:)/sum(mu); % normalize it % define the output of the neural networ y = mu'*theta;