Congratulations! You are the 10 millionth person to make this mistake!
Your reward will be a commensurate one, where you will get a free trip to someplace that you don't really want or need to go. In fact, we won't even tell you where that will be! Just someplace random, with no return ticket provided of course. ;-)
Why do I say this trip would be a reasonable reward compared to what you did? Because you did something wrong in MATLAB, getting a result that was not what you wanted or expected, pretty much random.
Ok, seriously, you are indeed the zillionth person to make this mistake. what you did was copy the polynomial coefficients, but ONLY to a few digits of precision.
MATLAB shows a coefficient like this:
p03 = -0.2879 (-5.294, 4.718)
But, in reality, that is not the exact number. In fact, it has roughly 10 more digits, at least the first few of which are seriously important to be able to reproduce that fit. For high degree polynomials, they are probably ALL important.
mdl = fit([x',y'],z','poly33')
Linear model Poly33:
mdl(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p30*x^3 +
p21*x^2*y + p12*x*y^2 + p03*y^3
Coefficients (with 95
p00 = -15.95 (-54.59, 22.69)
p10 = -24.53 (-26.98, -22.08)
p01 = 272.2 (236.4, 307.9)
p20 = 0.8164 (0.7281, 0.9046)
p11 = -5.32 (-6.046, -4.595)
p02 = -0.4944 (-11.09, 10.1)
p30 = -0.008723 (-0.009812, -0.007633)
p21 = 0.02402 (0.01546, 0.03258)
p12 = 0.001906 (-0.07994, 0.08375)
p03 = -0.05648 (-1.039, 0.9258)
coeffvalues(mdl)
ans =
Columns 1 through 7
-15.9519463869469 -24.5274287490288 272.156214109965 0.816362470862472 -5.32047404262406 -0.49436327561336 -0.00872253302253303
Columns 8 through 10
0.0240213120213121 0.00190584415584616 -0.0564814814814792
So, I fit your data with a polynomial model, then extracted the coefficients as a vector.
STILL, don't copy and paste those numbers!!!!!!!!!
PC = coeffvalues(mdl);
p00 = PC(1)
p00 =
-15.9519463869469
Instead, extract them as the exact numbers that MATLAB returned, as I did above.
Best Answer