用MATLAB情人节表白

时间:2022-07-13 00:10:13 阅读: 最新文章 文档下载
说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。


MATLA情人节表



% volume data

[X,YZ] = meshgrid(li nspace(-3,3,101));

F = -X.A2.*Z.A3 - (9/80).*Y.A2.*Z.A3 + (X.A2 + (9/ 4).*Y.A2 + 乙人2 - 1).A3; % in itialize figure

hFig = figure('Me nubar',' non e', 'Color','w'); pos = get(hFig, 'Positi on');

set(hFig, 'Position', [pos(1)-0.15*pos(3) pos(2) 1.3*pos(3) pos(4)]); % in itialize 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 in side of the mesh with an isosurface to

% block ren deri ng of the back side of the heart patch(isosurface(F,-1e-3), 'FaceColor','w', 'EdgeColor',' none') hidde n on % hidde n surface removal % con tours in the y-z pla ne

for iX = [35 38 41 45 48 51 54 57 61 64 67] pla ne = reshape(F(:,iX,:), [101

101]); cData = con tourc(pla ne, [0 0]);






xData = iX.*ones(1,cData(2,1)); line(xData, cData(2,2:end), cData(1,2:end), ...

'Color','r', 'Parent',hAxes) pause(.1) end % contours in the x-z plane for iY = [41 44 47 51 55 58 61]

plane = reshape(F(iY,:,:), [101 101]); cData = contourc(plane, [0 0]); yData = iY.*ones(1,cData(2,1));

line(cData(2,2:end), yData, cData(1,2:end), ... 'Color','r', 'Parent',hAxes) pause(.1) end % contours in the x-y plane

for iZ = [36 38 40 42 44 46 48 50 52 54 56 58 60 62 64 66 69 71] plane =

F(:,:,iZ);

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

if size(cData,2) > (cData(2,1)+1) startIndex = cData(2,1)+2; zData =

iZ.*ones(1,cData(2,1));

line(cData(1,2:(startIndex-1)), cData(2,2:(startIndex-1)), zData, ...

'Color','r', 'Parent',hAxes)

end

zData = iZ.*ones(1,cData(2,startIndex));

line(cData(1,(startIndex+1):end), cData(2,(startIndex+1):end), zData, ...

'Color','r', 'Parent',hAxes) pause(.1) end % text

props = {'FontWeight','bold', 'FontAngle','italic', 'FontSize',100}; pause(.2) text(7,50,70, 'I', props{:} pause(.5) text(80,50,43, 'YOU', props{:} pause(.2)

% equation props = {'FontSize',10, 'Interpreter','latex'}; text(30,45,30, 'I LOVE YOU', props{:}; drawnow




本文来源:https://www.wddqw.com/doc/8f06d7d425284b73f242336c1eb91a37f1113288.html