Question

I have data for x and y when z=z1, z=z2 and z=z3. I'd like to plot the data on a 3d graph and approximate the curves with a 3d surface and to know the equation of the surface. Will this be easier to implement on R or on Mathematica? For instance how can I do it in R? Thanks

Data (example):

For z=0
y   0.00    1.50    1.92    2.24
x   0.0000  0.0537  0.0979  0.2492

For z=2
y   0.00    2.21    2.83    3.07
x   0.0000  0.0173  0.0332  0.0655

For z=5
y   0.00    0.29    2.49    3.56
x   0.0000  0.0052  0.0188  0.0380
Était-ce utile?

La solution

In Mathematica:

Suppose you have a set of points qt:

ListPointPlot3D[qt]

Mathematica graphics

You could easily build an interpolation function:

Plot3D[Interpolation[qt][x, y], {x, -2, 2}, {y, -2, 2}, Ealuated -> True]

Mathematica graphics

If you need an explicit function model, you can propose one and calculate its parameters:

model = a x^2 + b y^2;
fit = FindFit[qt, model, {a, b}, {x, y}];
Show[Plot3D[model /. fit, {x, -2, 2}, {y, -2, 2}, PlotRange -> All], 
     ListPointPlot3D[qt, PlotStyle -> Directive[PointSize[Medium], Red]]]

Mathematica graphics

Edit

And it is fairly easy to plot nice graphs:

Mathematica graphics

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top