matlab有趣表白程序_(完整版)用MATLAB情人节表白

情人节表白

% volume data

[X,Y

,Z] = meshgrid(linspace(-3,3,101));

F = -X.^2.*Z.^3 - (9/

80).*Y.^2.*Z.^3 + (X.^2 + (9/

4).*Y.^2 + Z.^2 - 1).^3;

% initialize figure

hFig = figure(Menubar,none, Color,w);

pos = get(hFig, Position);

set(hFig, Position, [pos(1)-0.15*pos(3) pos(2) 1.3*pos(3) pos(4)]);

% initialize axes

hAxes = axes(Parent,hFig, DataAspectRatio,[1 1 1], ...

XLim,[30 120], YLim,[35 65], ZLim,[30 75]);

view(-39,30);

axis off

% Fill the inside of the mesh with an isosurface to

% block rendering of the back side of the heart

patch(isosurface(F,-1e-3), FaceColor,w, EdgeColor,none)

hidden on

% hidden surface removal

% contours in the y-z plane

for iX = [35 38 41 45 48 51 54 57 61 64 67]

plane = reshape(F(:,iX,:), [101 101]);

cData = contourc(plane, [0 0]);

情人节表白 % volume data [X,Y ,Z] = meshgrid(linspace(-3,3,101)); F = -X.^2.*Z.^3 - (9/ 80).*Y.^2.*Z.^3 + (X.^2 + (9/ 4).*Y.^2 + Z.^2 - 1).^3; % initialize figure hFig = figure(Menubar,none, Color,w); pos = get(hFig, Position); set(hFig, Position, [pos(1)-0.15*pos(3) pos(2) 1.3*pos(3) pos(4)]); % initialize axes hAxes = axes(Parent,hFig, DataAspectRatio,[1 1 1], ... XLim,[30 120], YLim,[35 65], ZLim,[30 75]); view(-39,30); axis off % Fill the inside of the mesh with an isosurface to % block rendering of the back side of the heart patch(isosurface(F,-1e-3), FaceColor,w, EdgeColor,none) hidden on % hidden surface removal % contours in the y-z plane for iX = [35 38 41 45 48 51 54 57 61 64 67] plane = reshape(F(:,iX,:), [101 101]); cData = contourc(plane, [0 0]);
经验分享 程序员 微信小程序 职场和发展