立体心形图像
立体心形貌似只能由笛卡尔方程得到:
(x2+9y2/4+z2−1)3−x2z3−9y2z3/80=0(x2+9y2/4+z2−1)3−x2z3−9y2z3/80=0
画图时用 isosurface 和 patch 函数:
图形1:
程序:
f=@(x,y,z)(x.^2+ (9./4).*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (9./80).*y.^2.*z.^3;
[x,y,z]=meshgrid(linspace(-3,3));
val=f(x,y,z);
[p,v]=isosurface(x,y,z,val,0);
patch('faces',p,'vertices',v,'facevertexcdata',jet(size(v,1)),'facecolor','w','edgecolor','flat');
view(3);grid on;axis equal;
图形2:
f=@(x,y,z)(x.^2+ (9./4).*y.^2 + z.^2 - 1).^3 - x.^2.*z.^3 - (9./80).*y.^2.*z.^3;
[x,y,z]=meshgrid(linspace(-1.5,1.5));
val=f(x,y,z);
isosurface(x,y,z,val,0);
axis equal;view(3);colormap([1 0.2 0.2])