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일

0 개 추천

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.

댓글을 달려면 로그인하십시오.

카테고리

태그

질문:

2015년 6월 10일

댓글:

2020년 6월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by