What do I do to fit a surface to given data points in MATLAB?
2 views (last 30 days)
Show older comments
Does someone here know any command in MATLAB that adjusts a set of points and give me the equation of the surface found?
This is similar to command polyfit but I want for a surface, not a curve.
0 Comments
Answers (4)
Gareth Thomas
on 31 Aug 2011
Hi Danilo,
Try using the curve fitting toolbox.
Here is the link to:
load franke
f = fit( [x, y], z, 'poly23' )
plot(f, [x,y], z)
Gives the nice answer of:
Linear model Poly23:
f(x,y) = p00 + p10*x + p01*y + p20*x^2 + p11*x*y + p02*y^2 + p21*x^2*y +
p12*x*y^2 + p03*y^3
Coefficients (with 95% confidence bounds):
p00 = 1.118 (0.9149, 1.321)
p10 = -0.0002941 (-0.000502, -8.623e-005)
p01 = 1.533 (0.7032, 2.364)
p20 = -1.966e-008 (-7.084e-008, 3.152e-008)
p11 = 0.0003427 (-0.0001009, 0.0007863)
p02 = -6.951 (-8.421, -5.481)
p21 = 9.563e-008 (6.276e-009, 1.85e-007)
p12 = -0.0004401 (-0.0007082, -0.0001721)
p03 = 4.999 (4.082, 5.917)
I hope that this helps you.
Gareth
0 Comments
dave
on 4 Jun 2012
I have the same problem of Danilo. I'm trying your solution, but entering
load franke
There is this error:
Error using ==> load
Unable to read file franke: No such file or directory
Maybe it is due to the absence of the file. Where can I find franke's database file or are there other solutions?
Thanks!
Dave
0 Comments
See Also
Categories
Find more on Spline Postprocessing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!