Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Mathematics
General TopicsResearchOperations ResearchStatisticsMathematical LogicNumerical AnalysisUndergraduate MathAlgebra HelpRecreational Math
Math Software
MapleMathematicaMATLABScilabSASSPSS

Math Forum / Math Software / Scilab / July 2006



Tip: Looking for answers? Try searching our database.

ellipsoid surface in 3d space

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
matt@ezekiele - 28 Jul 2006 11:33 GMT
hi group,

I have a matrix A (3xn) with which to draw an ellipsoid in 3d space:

1) the axes **directions** (U see below) are the eigenvectors of A*A.'
2) the axes **lenghts** (l see below) are the singular values of A

So, I performed the follows:

--> [U,S,V] = svd(A),
--> l = diag(S(1:3,1:3)),

and I verified [U,l] was the expected values for axes directions and
lengths.
But now, I need to draw the ellipsoid surface which has **that**
axes directions and axes lenghts.

So, my question is the following:
How can I draw an ellipsoid surface having ellipsoid's axes directions and
axes lengths?

Thanks in advance

Matt
Enrico Segre - 30 Jul 2006 16:41 GMT
> So, my question is the following:
> How can I draw an ellipsoid surface having ellipsoid's axes directions and
> axes lengths?

what you can do in scilab is to produce a set of facelets which
approximate the ellipsoid surface, and to plot them with plot3d or the
like, facelet mode. As an example, attached is the function sphere()
from the toolbox ENRICO. It should be rather easy to extend it to an
ellipsoid, either by means of a coordinate transformation of all of the
points of the generated facelets, or directly on the parametric
representation of the vertices as functions of (u,v). I'm just lazy
about working out for you the geometry for the general case, all the
matrix manipulations involved, etc.

hth, Enrico

function [xx,yy,zz]=sphere(x0,r,n)
// expanded from SCI/surface/surfaces.sci
 [lhs,rhs]=argn(0);
 if rhs<3 then n=16; end
 if rhs<2 then r=1; end
 if rhs<1 then x0=[0,0,0]; end

 if size(x0)==[3,1] then x0=x0'; end
 if size(x0,2)<>3 then
    disp('wrong size of x0'); return
 end
 ns=size(x0,1)
 if length(r)<>ns then r=r(1)*ones(ns,1); end

 vn=2*n

// prototype sphere
 u = linspace(-%pi/2,%pi/2,n);
 v = linspace(0,2*%pi,vn);  
 x= cos(u)'*cos(v);
 y= cos(u)'*sin(v);
 z= sin(u)'*ones(v);

 in=1:(n-1); inp=2:n; in2=1:(vn-1)
 xxx=[matrix(x(in,in2+1),1,(n-1)*(vn-1));
      matrix(x(in,in2),1,(n-1)*(vn-1));
      matrix(x(inp,in2),1,(n-1)*(vn-1));
      matrix(x(inp,in2+1),1,(n-1)*(vn-1))]
 yyy=[matrix(y(in,in2+1),1,(n-1)*(vn-1));
      matrix(y(in,in2),1,(n-1)*(vn-1));
      matrix(y(inp,in2),1,(n-1)*(vn-1));
      matrix(y(inp,in2+1),1,(n-1)*(vn-1))]
 zzz=[matrix(z(in,in2+1),1,(n-1)*(vn-1));
      matrix(z(in,in2),1,(n-1)*(vn-1));
      matrix(z(inp,in2),1,(n-1)*(vn-1));
      matrix(z(inp,in2+1),1,(n-1)*(vn-1))]


//multiplication of spheres

  nf=size(xxx,2);
  xx=zeros(4,nf*ns); yy=xx; zz=xx
  for i=1:ns
    xx(:,((i-1)*nf+1):i*nf)=xxx*r(i)+x0(i,1)
    yy(:,((i-1)*nf+1):i*nf)=yyy*r(i)+x0(i,2)
    zz(:,((i-1)*nf+1):i*nf)=zzz*r(i)+x0(i,3)
  end

endfunction
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.