plotting ellipsoid in matlab

5 次查看(过去 30 天)
girdhari jakhar
girdhari jakhar 2015-6-10
hi, I want to plot an ellipsoid in matlab given my equation as v=a*x.^2+b*y.^2+c*z.^2+d*x.*y+e=0; where a,b,c,d,e are constants acting as coefficients of the equation.Also I want to observe different ellipse by whose combination ellipsoid is made of. Further I want to do this for range of values of x , y and z.please guide me how can i do this.
my work: %I have assigned values to a,b,c,d,e.alp and beta....the further cose is given below. [Y,X,Z] = ndgrid(linspace(beta,-beta,100),linspace(-alp,alp,100),linspace(-100000000,100000000,100)); V = a*X.^2+b*Y.^2+d*(Z).^2+c*X.*Y-1; % evaluate your implicit function
p = patch(isosurface(X,Y,Z,V,0));
isonormals(X,Y,Z,V,p);
set(p,'FaceColor','c','Marker','d','FaceLighting','gouraud','EdgeLighting','gouraud','FaceAlpha',0,'EdgeColor','y');
daspect([1 1 1]) axis square; grid on; camlight view(-27,46); lighting gouraud

回答(1 个)

Image Analyst
Image Analyst 2015-6-10
Did you know there's an ellipsoid() function:
[x,y,z] = ellipsoid(xc,yc,zc,xr,yr,zr,n)
generates a surface mesh described by
three n+1-by-n+1 matrices, enabling surf(x,y,z)
to plot an ellipsoid with center (xc,yc,zc) and semi-axis lengths (xr,yr,zr).
  2 个评论
Harris John
Harris John 2020-6-3
The user is asking for a rotated ellipsoid equation hence the matlab implementation doesnt work.
Image Analyst
Image Analyst 2020-6-3
If you knew the angle the axis was rotated by, you could multiply x, y, and z by the rotation matrix.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by