Fit equation to 3D data array in Mathematica

3 replies · 3K views · last reply
mattmatt
Messages
4
Reaction score
0
Hi there,
I just began using Mathematica today and I was wondering if there is a way to make the program generate an equation of a surface given a 3d array?

What I need it to do is to give me an equation of the surface so that given any two variables I can find the value of the third one.

Any advice will be highly appreciated.

Here is a screenshot of what the surface looks like:

Mathematica input ListSurfacePlot3D of imported table data, with a 3D surface plot of z values over axes labelled 5000 to 20000 and 10 to 50, rising sharply toward the lower-right.


And here is the array:

4 1000 0.10331
4 1250 0.08479
4 1500 0.07125
4 2000 0.05700
4 3000 0.04133
4 5000 0.02921
4 10000 0.01995
4 15000 0.01660
4 20000 0.01510
9 1000 0.11400
9 1250 0.09476
9 1500 0.08265
9 2000 0.06698
9 3000 0.05201
9 5000 0.03919
9 10000 0.02993
9 15000 0.02630
9 20000 0.0245
16 1000 0.12754
16 1250 0.10901
16 1500 0.09690
16 2000 0.08123
16 3000 0.06555
16 5000 0.05344
16 10000 0.04418
16 15000 0.04235
16 20000 0.04075
25 1000 0.14250
25 1250 0.12683
25 1500 0.11400
25 2000 0.09904
25 3000 0.08336
25 5000 0.07125
25 10000 0.06199
25 15000 0.06070
25 20000 0.05920
36 1000 0.16388
36 1250 0.14963
36 1500 0.13538
36 2000 0.12041
36 3000 0.10474
36 5000 0.09263
36 10000 0.08336
36 15000 0.08250
36 20000 0.08115
49 1000 0.19024
49 1250 0.17100
49 1500 0.16031
49 2000 0.14535
49 3000 0.12968
49 5000 0.11756
49 10000 0.10830
49 15000 0.10750
49 20000 0.10600
 
Attachments
  • Mathematica input ListSurfacePlot3D of imported data, with output list of triples and a blue-shaded 3D surface plot with axes ticks 5000 to 20000 and 10 to 50 and values 0.05 to 0.15.
    Screen Shot 2013-10-22 at 5.48.30 PM.png
    63.7 KB · Views: 809
That's generally a very hard problem, unless you already know the basic equation of the surface.
In those situations where the basic equation is known, you can use your surface data to fit the equation to the surface using regression techniques. Still a lot of number crunching though, and what if the equation doesn't pass through the surface data in one or more regions?
 
Taming surfaces to keep them from extending beyond where they are intended to go is a black art. I used to model 3D surfaces on an IBM 360 in FORTRAN on punch cards. It was ... educational.
 
The equation doesn't have to be perfect, as long as it's a close approximation.
I found another program that can do this. It has a database of hundreds of basic equations and it fits the best one automatically for you. I was wondering if Mathematica can do this.

In the case of this example it spat out the following:

3D surface plot of fitted curve Z against X and Y, rainbow-coloured, with scattered data points; header reads Rank 11 Eqn 316 z=a+bx+c/y+dx^2+e/y^2+fx/y+gx^3+h/y^3+ix/y^2+jx^2/y.
 
Attachments
  • 3D surface plot of fitted data, Z against X and Y, with colour gradient from red to purple and scattered data points; header lists equation 316 fit with r² = 0.99973872.
    graph.jpg
    40.5 KB · Views: 636