+
Hello,
I want to delete prior questions online but am getting an error message?
Please see R code in enclosed file. I don't understand the error message.
The parametric equations of an ellipsoid can be written in terms of spherical
coordinates. The three spherical coordinates are converted to Cartesian
coordinates by
X=a cos (α) sin(θ)
Y=b sin(α) sin(θ)
Z=c cos(θ)
The parameter α varies from 0 to 2 π and θ varies from 0 to π . Here ( X o , Y
o ,Z o ) is the center of the ellipsoid, and θ is the angle of rotation. I need
to come up with an expression for the ellipsoid expressed parametrically as the
path of a point in 3- space. I think that it is something like the following:
x (alpha)- x0 + a * cos(theta) * cos(alpha) - b * sin(theta) * sin(alpha)
y(alpha) - y0 + a * cos(theta) * sin(alpha) + b * sin(theta) * cos(alpha)
z (alpha)- z0 + a * cos(theta) * sin(alpha) + c * sin(theta) * cos(alpha)
Do I have these equations correct?
Most of the books I have read use eigenvectors. The eigenvectors of course
consist of the direction cosines. My difficulty is going from that approach to
the approach that Alberto Monteiro took in his message on the 9 October 2006. I
understand the R code and am using it for a two-dimensional ellipse problem.
There does not seem to be allowance for the new coordinates of the center of
the ellipsoid under the transformation when using direction cosines. By that I
mean adding the centroid coordinates would not be necessary.
I need to come up with an example where I do it both ways(as above and using
direction cosines).
My confusion lies in the fact that rather than one rotational angle theta there
are 9 direction cosines. Can you assist with this.
Sincerely,
Mary A. Marion
mat - matrix(c(1,1,1,1,3,2,1,2,2), 3, 3)
eigens - eigen(mat)
evs - eigens$values
evecs - eigens$vectors
a - evs[1]
b - evs[2]
c - evs[3]
x0 - 5
y0 - 10
z0 - 3
alpha - atan(evecs[ , 1][2] / evecs[ , 1][1])
theta - seq(0, 2 * pi, length=(1000))
# See Timm, Multivariate Analysis, page 62, Figure 1.6.2
# See Lay, Linear Algebra, third edition, page 84
x - x0 + a * cos(theta) * cos(alpha) - b * sin(theta) * sin(alpha)
y - y0 + a * cos(theta) * sin(alpha) + b * sin(theta) * cos(alpha)
z - z0 + a * cos(theta) * sin(alpha) + c * sin(theta) * cos(alpha)
plot(x, y, z, type = l, main = expression(x y z), asp = 1,
xlim=c(-5,20),ylim=c(-5,20), zlim=-5,20,xaxs = 'i', yaxs = 'i', zaxs='i')
error: Error in strsplit(log, NULL) : non-character argument
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.