# [R] How to plot Ellipsoid like function

Uwe Wolfram uwwo at in-chemnitz.de
Mon Dec 13 16:13:54 CET 2010

```Dear R-Users,

I am currently trying to fit a tensorial function in its principal
coorinate system. The function is given by:

1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2 + (x1 + x2
+ x3)/xi0

Where eps0 = 0.0066, chi0 = -0.66 and xi0 = 0.011 are obtained from
experimental data using nls().I am able to plot the experimental points
that delivered the parameters of the function. For my thesis, however, I
need to overlay the fitted surface. So far I am using the following code
which wonderfully plots the experimental points in 3D:

===================================================================
# from demo(bivar)
require(rgl)
require(misc3d)
require(MASS);

# New window
open3d()
# clear scene:
clear3d("all")
# setup env. That is, background, light and so on:
bg3d(color="#887777")
light3d()
# spheres at points in principal strain space
# draws points alternatively
plot3d(e1,e2,e3, col="#CCCCFF")
===================================================================

According to the examples on http://rgl.neoscientists.org/gallery.shtml
I tried to overlay the point plot using surface3d. However, these were
only functions of type y ~f(x1, x2). I think that the surface could be
plotted if I could provide the gridpoints correctly. Using
xyz.coords(1~(x1^2 + x2^2 + x3^2 - chi0*(x1*x2 + x1*x3 + x2*x3))/eps0^2
+ (x1 + x2 + x3)/xi0, y = NULL, z = NULL) did unfortunately not solve
the problem.

Is there any function that can generate the surface for the given
function such as ContourPlot3D in Mathematica.

Thanks a million!

Uwe
--
Uwe Wolfram
Dipl.-Ing. (Ph.D Student)
__________________________________________________
Institute of Orthopaedic Research and Biomechanics
Director and Chair: Prof. Dr. Anita Ignatius
Center of Musculoskeletal Research Ulm
University Hospital Ulm
Helmholtzstr. 14
89081 Ulm, Germany
Phone: +49 731 500-55301
Fax: +49 731 500-55302
http://www.biomechanics.de

```