%%% %%% Example of RBF network design %%% clear all, close all, clc N = 30; % Number of data (patterns) std_noise = 0.1; % Noise affecting the data % data for approximation (good generalisation properties) % MN = 5; eg = 0.02; sc = 1.0; % data for exact interpolation MN = 30; eg = 1e-7; sc = 1/N; % eg = GOAL - Mean squared error goal, default = 0.0. % sc = SPREAD - Spread of radial basis functions, default = 1.0. % MN - Maximum number of neurons, default is number of data x = linspace(0,1,N); % Patterns (N) fx = 0.5 + 0.4*sin(2*pi*x); % Target function (Bishop, 1995) n = std_noise*mean(fx)*randn(1,N); % Noise affecting the data fn = fx + n; % eg: sum-squared error goal % sc: spread constant % MN Maximum number of neurons, % default is N net = newrb(x,fn,eg,sc,MN); F = net(x); figure, plot(x,fx,'--',x,fn,'o',x,F,'-') xlabel('Input (x)'), title('f(x) = 0.5 + 0.4 * sin(2 * pi * x)') ylabel('y(x) F(x)'), legend('Real function y(x)','Noisy data o','Interpolation F(x)')