title: Defining fittype object from custom function
body: <p>I'm trying to define a <code>fittype</code> object from the function (written in a separate .m file)</p>
  
  <pre><code>y = fun(x,c1,c2,c3,c4,c5,c6,P),
  </code></pre>
  
  <p>where <code>c1</code>, <code>c2</code>, <code>c3</code>, <code>c4</code>, <code>c5</code>, <code>c6</code> are the variable fitting parameters and <code>P</code> is a constant struct: </p>
  
  <pre><code>ft = fittype(@(c1,c2,c3,c4,c5,c6,x) fun(x,c1,c2,c3,c4,c5,c6,P), 'independent', {'x'}, 'dependent', {'y'}); 
  </code></pre>
  
  <p>but get the following errors:</p>
  
  <pre><code>Error using fittype&gt;iTestCustomModelEvaluation (line 730)
  Custom equations must produce an output vector, matrix, or array that is the same size and shape as the input data.
  This custom equation fails to meet that requirement:
  
  Error in fittype&gt;iCreateFittype (line 367)
      iTestCustomModelEvaluation( obj );
  
  Error in fittype (line 324)
                  obj = iCreateFittype( obj, varargin{:} );
  </code></pre>
  
  <p>The function works fine producing same size <code>x</code> &amp; <code>y</code> data so I have no clue why defining the fittype fails.</p>