plotting ellipsoid in matlab
4 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
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
2020 年 6 月 3 日
The user is asking for a rotated ellipsoid equation hence the matlab implementation doesnt work.
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 Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!