function sheet11
clf;

% Configuration
iters = 200;
sigmas = [ ... ];
eta = 0.1;
centers = 20;

% Generate data 
[X,Y] = gen_data(100);

% Compute RBF network for different sigmas
for s = 1:length(sigmas)

   % Init network
   C = init_rbfnet(sigmas(s), centers);

   % Train network in chunks of 10
   err = zeros(1, iters);
   for i = 1:iters
       idx = randperm(length(X));
       idx = idx(1:10);

       C = update_rbfnet(C, X(idx), Y(idx), eta);
       P = apply_rbfnet(C, X); 

       % Determine error
       err(i) = mean((Y - P).^2);
   end

   % Make nice plots
   subplot(2,3,s); hold on;
   plot(X,Y,'.'); plot(X,P,'r-');
   subplot(2,3,s+3);
   plot(err);
end


% Init RBF network
% Input:
%   m     Number of RBF centers
%   w     Kernel width (sigma)
% Output:
%   C     Struct with alphas, mus and sigma
%
function C = init_rbfnet(w, m) 
   C.sigma = ...
   C.alphas = ...
   C.mus = ...

% Apply RBF network
% Input:   
%    C    Struct with alphas, mus and sigma
%    X    Testing data (1 x n)
% Output:  
%    Y    Predictions (1 x n)
%
function Y = apply_rbfnet(C, X)
   ...

% Update RBF network
% Input:
%    C:    Struct with alphas, mus and sigma
%    X:    Training data (1 x n)
%    Y:    Training labels (1 x n)
%    eta:  Learning rate
% Output:
%    C:    Struct with updated alphas, mus and sigma
function C = update_rbfnet(C, X, Y, eta)
   ...


% Generate data
% Input: 
%    n    Number of data points
% Output:
%    X    Data points (1 x n)
%    Y    Labels (1 x n)
function [X,Y] = gen_data(n)
   ...
