title: Matlab cftool producing wrong coefficients
body: <p>So i have this data</p>
  
  <pre><code>x
  1.0423
  2.8249
  3.2016
  2.0851
  1.0299
  4.7397
  0.4104
  0.5285
  0.7102
  0.8323
  3.1048
  2.8685
  0.2604
  4.6560
  3.6433
  3.6892
  0.3170
  4.3022
  4.6720
  4.9220
  y
      2.0529
     -3.0669
     -2.3631
     -0.7300
      1.4354
      2.0260
      0.5980
      0.5296
      1.3405
      1.7361
     -1.5876
     -2.7872
      1.0788
      1.3677
     -0.1355
     -1.5755
      0.7811
     -0.8328
     -0.0592
      2.0927
  </code></pre>
  
  <p>And I tried to fit an 8th order polynomial to the data using cftool. </p>
  
  <p>These are the results I get which are wrong</p>
  
  <pre><code>Linear model Poly8:
       f(x) = p1*x^8 + p2*x^7 + p3*x^6 + p4*x^5 + 
                      p5*x^4 + p6*x^3 + p7*x^2 + p8*x + p9
  Coefficients (with 95% confidence bounds):
         p1 =    -0.05446  (-0.126, 0.01711)
         p2 =       1.088  (-0.3839, 2.561)
         p3 =      -8.762  (-21.23, 3.706)
         p4 =        36.2  (-19.89, 92.3)
         p5 =      -80.85  (-225.3, 63.62)
         p6 =       94.32  (-119.9, 308.6)
         p7 =      -52.21  (-227.5, 123.1)
         p8 =       12.21  (-59.01, 83.42)
         p9 =    -0.05814  (-10.72, 10.61)
  
  Goodness of fit:
    SSE: 4.083
    R-square: 0.9225
    Adjusted R-square: 0.8661
    RMSE: 0.6092
  </code></pre>
  
  <p>This is a cftool plot of the fit which looks fine
  <img src="https://i.stack.imgur.com/XgHDu.png" alt="Cftool plot of the fit which looks fine"></p>
  
  <p>and this is what plotting the coefficients actually looks like.
  <img src="https://i.stack.imgur.com/vsXLH.png" alt="What plotting the coefficients actually looks like"></p>
  
  <p>Code for plotting coefficients:</p>
  
  <pre><code>xx = 0:1/100:5;
  yy = -0.05446*xx.^8 +1.088*xx.^7 -8.762*xx.^6 +36.2*xx.^5 -80.85*xx.^4 +94.32*xx.^3 -52.21*xx.^2 +12.21*xx -0.05814;
  plot(xx,yy)
  </code></pre>
  
  <p>Does anyone know whats going on and how to get the correct coefficients of the plot that cftool produces?</p>