plotting ellipsoid in matlab
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
0 commentaires
Réponses (1)
Image Analyst
le 10 Juin 2015
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 commentaires
Harris John
le 3 Juin 2020
The user is asking for a rotated ellipsoid equation hence the matlab implementation doesnt work.
Image Analyst
le 3 Juin 2020
If you knew the angle the axis was rotated by, you could multiply x, y, and z by the rotation matrix.
Voir également
Catégories
En savoir plus sur Surface and Mesh Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!