matlab生成情人节礼物

f=@(x,y,z)x.^2.*z.^3+9*y.^2.*z.^3/80-(x.^2+9*y.^2/4+z.^2-1).^3;  %心形曲线函数
[x,y,z]=meshgrid(-1.5:0.1:1.5);
v=f(x,y,z);
h=patch(isosurface(x,y,z,v,0));
isonormals(x,y,z,v,h);
set(h,'FaceColor','r','EdgeColor','none');
title('I Love you baby');
alpha(0.6);
grid off;
axis([-1.5 1.5 -1.5 1.5 -1.5 1.5]);
lighting Gouraud;
h=camlight('left');
for i=1:360
    camorbit(1,0);
    camlight(h,'left');
    drawnow
end

  matlab生成情人节礼物_第1张图片

转载于:https://www.cnblogs.com/huxingkeji/p/6409564.html

你可能感兴趣的:(matlab生成情人节礼物)