MATLAB: Attempting to find a fit to this data

analytical functioncurve fitting

Hi there,
Looking to find a curve fit to this data as shown (and attached) in this post. The catch is that it's 3D data, not 2D…
I am aware of the Kriging function, however I require a function where I know the form of the resulting function so that I can analytically find its derivative.
Any thoughts would be appreciated…

Best Answer

>> f=fit([x,y],log(z),'poly55')
Linear model Poly55:
f(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 + p40*x^4 + p31*x^3*y + p22*x^2*y^2
+ p13*x*y^3 + p04*y^4 + p50*x^5 + p41*x^4*y + p32*x^3*y^2
+ p23*x^2*y^3 + p14*x*y^4 + p05*y^5
Coefficients (with 95% confidence bounds):
p00 = 21.69 (21.5, 21.89)
p10 = 0.8578 (-0.2567, 1.972)
p01 = 0.3813 (-1.914, 2.677)
p20 = 9.216 (3.857, 14.58)
p11 = -12.69 (-18.11, -7.278)
p02 = 0.1147 (-9.909, 10.14)
p30 = -54.22 (-67.48, -40.97)
p21 = 31.53 (21.3, 41.76)
p12 = 16.31 (4.092, 28.53)
p03 = -1.082 (-21.32, 19.16)
p40 = 82.65 (67.27, 98.03)
p31 = 7.202 (-3.904, 18.31)
p22 = -55 (-65.89, -44.11)
p13 = 0.9892 (-12.07, 14.05)
p04 = 0.2342 (-18.94, 19.41)
p50 = -38.6 (-45.28, -31.92)
p41 = -29.1 (-34.41, -23.79)
p32 = 24.53 (19.51, 29.56)
p23 = 15.26 (10.15, 20.37)
p14 = -4.911 (-10.44, 0.6136)
p05 = 0.4245 (-6.466, 7.315)
>> zhat=exp(f(x,y));
>> hS=scatter3(x,y,zhat,'r');
>>
isn't too bad it appears--
The log transform was needed to counteract the large range of the interpolant; standardizing it might help further.
But, MUST the derivative be analytic over a single function? Could you not use spline interpolant that is differentiable through the pieces?