title: MATLAB nlinfit with multiple unknowns
body: <p>I am trying to fit a curve using <strong><code>nlinfit</code></strong>, however, I have 3 unknowns.</p>
  
  <p>The equation that I am trying to fit is the laminar velocity profile in a tube.</p>
  
  <p><strong><code>u = umax( 1 - ( r / R ) ^ 2 )</code></strong>, where <code>u</code> is the velocity, <code>umax</code> is the centerline velocity, <code>r</code> is the distance from the centerline and <code>R</code> is the radius of the tube.</p>
  
  <p>The problem is that <code>umax</code>, <code>r</code> and <code>R</code> are unknowns.  </p>
  
  <p><a href="http://www.mne.psu.edu/cimbala/learning/fluid/CV_Momentum/pipe_eg.gif" rel="nofollow noreferrer">http://www.mne.psu.edu/cimbala/learning/fluid/CV_Momentum/pipe_eg.gif</a>
  <img src="https://i.stack.imgur.com/3xA1h.gif" alt="enter image description here"></p>
  
  <p>From the image above, the centerline is the axis. I have included code for 1 set of data:</p>
  
  <pre><code>clc
  clear all
  
  XMean = [0.13518 
  0.1599
  0.17035
  0.18053
  0.18849
  0.19577
  0.19373
  0.18781
  0.17245
  0.15728
  0.13404
  0.10981];
  
  r = [-5.5000
     -4.5000
     -3.5000
     -2.5000
     -1.5000
     -0.5000
      0.5000
      1.5000
      2.5000
      3.5000
      4.5000
      5.5000];
  
  plot( XMean, r )
  </code></pre>
  
  <p>I am not sure how to format the equation handle:</p>
  
  <pre><code>Eqn = @(u,y) u(1).*( 1 - ( ( u(2) - y ) / u(3) ).^2 );
  
  [ beta, R, J, CovB, MSE ] = nlinfit( YMean, r, Eqn, Alpha );
  </code></pre>
  
  <p>I would appreciate any help trying to fit this data. Thanks for your time.</p>