您好,欢迎访问三七文档
当前位置:首页 > 办公文档 > PPT模板库 > 用MATLAB情人节表白
用MATLAB情人节表白%volumedata[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;%initializefigurehFig=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)]);%initializeaxeshAxes=axes('Parent',hFig,'DataAspectRatio',[111],...'XLim',[30120],'YLim',[3565],'ZLim',[3075]);view(-39,30);axisoff%Filltheinsideofthemeshwithanisosurfaceto%blockrenderingofthebacksideoftheheartpatch(isosurface(F,-1e-3),'FaceColor','w','EdgeColor','none')hiddenon%hiddensurfaceremoval%contoursinthey-zplaneforiX=[3538414548515457616467]plane=reshape(F(:,iX,:),[101101]);cData=contourc(plane,[00]);xData=iX.*ones(1,cData(2,1));line(xData,cData(2,2:end),cData(1,2:end),...'Color','r','Parent',hAxes)pause(.1)end%contoursinthex-zplaneforiY=[41444751555861]plane=reshape(F(iY,:,:),[101101]);cData=contourc(plane,[00]);yData=iY.*ones(1,cData(2,1));line(cData(2,2:end),yData,cData(1,2:end),...'Color','r','Parent',hAxes)pause(.1)end%contoursinthex-yplaneforiZ=[363840424446485052545658606264666971]plane=F(:,:,iZ);cData=contourc(plane,[00]);startIndex=1;ifsize(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)endzData=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%textprops={'FontWeight','bold','FontAngle','italic','FontSize',100};pause(.2)text(7,50,70,'I',props{:})pause(.5)text(80,50,43,'YOU',props{:})pause(.2)%equationprops={'FontSize',10,'Interpreter','latex'};text(30,45,30,'ILOVEYOU',props{:});drawnow
本文标题:用MATLAB情人节表白
链接地址:https://www.777doc.com/doc-3745471 .html