title: MATLAB's newrb for designing radial basis networks does not behave in accordance to the documentation. Why?
body: <p>I'm trying to approximate various signals using radial basis networks. In particular, I make use of MATLAB's <code>newrb</code>.</p>
  
  <p>My problem is that this function seems to behave incorrectly if I follow the <a href="http://de.mathworks.com/help/nnet/ref/newrb.html" rel="nofollow">description</a> of <code>newrb</code>. As I understand it, it makes sense to transpose all arguments despite the documentation.</p>
  
  <p>The following example hopefully illustrates my problem.</p>
  
  <p>I create one period of a sine wave with 100 samples. I would like to approximate this sine wave by means of a radial basis network with maximally two hidden neurons. I have one input vector (<code>t</code>) and one target vector (<code>s</code>). Hence, according to the documentation, I should call <code>newrb</code> with two column vectors. However, the approximation is too good. In fact, the mean squared error is 0 which can't be true using only two neurons. Additionally, the visualization with <code>view(net)</code> shows not only one but 100 inputs if I use column vectors.</p>
  
  <p>In the example, the vectors corresponding to the "correct" (according to the documentation) function call are indicated by <code>_doc</code>, the ones corresponding to the "incorrect" call by <code>_not_doc</code>.</p>
  
  <p>Can anybody explain this behavior?</p>
  
  <pre><code>% one period sine signal with
  % carrier frequency = 1, sampling frequency = 100
  Ts  = 1 / 100;
  t   = 2 * pi * (0:Ts:1-Ts); % size(t) = 1 100
  s   = sin(t);               % size(s) = 1 100
  
  % design radial basis network
  MSE_goal    = 0.0;  % mean squared error goal, default value
  spread      = 1.0;  % spread of readial basis functions, default value
  max_neurons = 2;    % maximum number of neurons, custom value
  DF          = 25;   % number of neurons to add between displays, default value
  
  net_not_doc     = newrb( t , s , MSE_goal, spread, max_neurons, DF );   % row vectors
  net_doc         = newrb( t', s', MSE_goal, spread, max_neurons, DF );   % column vectors
  
  % simulate network
  approx_not_doc   = sim( net_not_doc, t );
  approx_doc       = sim( net_doc, t' );
  
  % plot
  figure;
  plot( t, s, 'DisplayName', 'Sine' );
  hold on;
  plot( t, approx_not_doc, 'r:', 'DisplayName', 'Approximation_{not doc}');
  hold on;
  plot( t, approx_doc', 'g:', 'DisplayName', 'Approximation_{doc}');
  grid on;
  legend show;
  
  % view neural networks
  view(net_not_doc);
  view(net_doc);
  </code></pre>