Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Vectors on ellipsoid surface
Date: Sun, 23 May 2010 17:42:05 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 57
Message-ID: <htbpdd$e9i$1@fred.mathworks.com>
References: <ht5ldf$7tf$1@fred.mathworks.com> <hta8lc$e4f$1@fred.mathworks.com> <htai71$i38$1@fred.mathworks.com> <htaqsk$5h1$1@fred.mathworks.com> <htba3v$iq3$1@fred.mathworks.com> <htbekb$afo$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1274636525 14642 172.30.248.37 (23 May 2010 17:42:05 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 23 May 2010 17:42:05 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1140591
Xref: news.mathworks.com comp.soft-sys.matlab:638495

> > But what I am not getting is how to give in P1 and P2 (the two points between which C lies), and is the projected C in 90 degrees of this line? 
> 
> Sorry? What are P1 and P2? I quote your post #1
> 
> My understanding is C is given, and C' is the projection on C on the surface of the ellipsoid to be found. In my code, C is called "c" (lower case); and C' is "x(:,imin)". 
> 

What you suggest is correct, only c lies on a line which runs from P1 to P2. This is a line through the ellipsoid. C' is the projection of c on the surface of the ellipsoid, where the angle between the line P1(or P2) to c and c to C' is 90 degrees. So I think here has been a misunderstanding.  
> > 
> > What should I do if my origin is not on [0,0,0], just change [X Y Z] = ellipsoid(0,0,0,radii(1),radii(2),radii(3),N); ?

> If you know 
> 1) the radii: radii(1), radii(2), and radii(3) (three scalars in a vector)
> 2) the corresponding orientation U1, U2, U3 (three vectors, they must be orthogonal and normed to 1)
> 3) and the center x0 (a vector) of your ellipsoid
> 
> Then define:
> U = [U(:,1) U(:,2) U(:3)]
> S = diag(1./radii.^2);
> Q = U*S*U'

Is Q even necessary?  After this code, I let the engine start. But I have the feeling somethings going wrong. What I have now is this:

C=[1.0150   -1.5380   -6.0150]


cx=1; cy=-5;cz=1; % Center of my ellipsoid


ax=12; ay=12; az=20; % radii of my ellipsoid


radii(1)=ax; radii(2)=ay; radii(3)=az;



U(:,1) = [0.1;0.2;1]; U(:,2) = [0.5;0.3;0.7]; U(:,3) = [0.6;0.6;0.4]  % example of

possible axis of my ellipsoid


% Data, generate ellipse centered at origin, { x: x'*Q*x = 1 }

c = C'-[cx; cy; cz]

% c = 1*randn(n,1)


U = [U(:,1) U(:,2) U(:,3)]

S = diag(1./radii.^2)

s = diag(S)

% Q = U*s*U'

A = U*diag(radii);