matlab怎么实现动态表白图的绘制-亚博电竞手机版

matlab怎么实现动态表白图的绘制

这篇文章主要介绍了matlab怎么实现动态表白图的绘制的相关知识,内容详细易懂,操作简单快捷,具有一定借鉴价值,相信大家阅读完这篇matlab怎么实现动态表白图的绘制文章都会有所收获,下面我们一起来看看吧。

提前祝女朋友节日快乐

1 展现

这里没上传视频图,放最后一张成品:

2 代码

漂亮的颜色随你挑:

clearclctic%%构造体积方程和坐标轴[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;%%展开画布hfigure=figure;sz=get(hfigure,'position');set(hfigure,'position',[sz(1)-0.15*sz(3)sz(2)1.3*sz(3)sz(4)]);%设置画布大小set(hfigure,'color','w','menu','none')%隐藏菜单,颜色做白haxes=axes('parent',hfigure,...?'dataaspectratio',[111],...???'xlim',[30120],'ylim',[3565],'zlim',[3075]);view([-3930]);%视角axisoff%关闭坐标轴%hiddenon%%制作出动态的隐形效果p=patch(isosurface(f,0));set(p,'facecolor','none','edgecolor','none');%心形线和面隐藏alpha(0);%使其为0透明度以便显示文字text(45,50,60,'wlz','fontweight','bold','fontsize',25,'color','m');%显示出文字pause(2)holdon%%描出y-z平面的心形轮廓forix=35:1:67plane=reshape(f(:,ix,:),101,101);cdata=contourc(plane,[00]);xdata=ix.*ones(1,cdata(2,1));plot3(haxes,xdata,cdata(2,2:end),cdata(1,2:end),'r');pause(0.1),drawnowend%%描出x-z平面的心形轮廓foriy=41:2:61plane=reshape(f(iy,:,:),101,101);cdata=contourc(plane,[00]);ydata=iy.*ones(1,cdata(2,1));plot3(haxes,cdata(2,2:end),ydata,cdata(1,2:end),'r');pause(.5),drawnowend%%描出x-y平面的心形轮廓foriz=36:1:71plane=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));plot3(haxes,cdata(1,2:(startindex-1)),...?????cdata(2,2:(startindex-1)),zdata,'r');endzdata=iz.*ones(1,cdata(2,startindex));plot3(haxes,cdata(1,(startindex 1):end),...??????cdata(2,(startindex 1):end),zdata,'r');pause(.1),drawnowend%%给三维心着色补光alpha(1)%恢复透明度set(p,'facecolor','m','edgecolor','none');camlight%补光lightinggouraudpause(.2)%做线line([2080],[5050],[52.52.5],'color','r')line([5050],[2080],[52.552.5],'color','r')line([5050],[5050],[3080],'color','r')pause(0.5)%文字部分;text(0,50,107,'好好疼你,陪你长大\heartsuit','fontweight','bold','fontsize',25,'color','r');pause(2)text(7,100,70,['wlz\heartsuit'],'fontweight','bold','fontangle','italic','fontname','trebuchet?ms','fontsize',45,'color','c');pause(.5)text(80,50,43,'you','fontweight','bold','fontangle','italic','fontname','trebuchet?ms','fontsize',60,'color','k');pause(.2)text(75,5,40,'超级爱你\heartsuit','fontweight','bold','fontangle','italic','fontname','trebuchet?ms','fontsize',20,'color','g');pause(.2)text(120,0,20,'xys\heartsuit','fontweight','bold','fontangle','italic','fontname','trebuchet?ms','fontsize',10,'color','r');pause(.2)uicontrol(hfigure,'style','edit','units','normalized','position',[0,0.8,1,0.12],...'backgroundcolor','[0,1,1]','string','520快乐','fontsize',40,'foregroundcolor','[1,0,1]');pause(.5)uicontrol(hfigure,'style','edit','units','normalized','position',[0,0.8,1,0.12],...'backgroundcolor','[0.3,0.75,0.93]','string','520快乐','fontsize',40,'foregroundcolor','[1,0,1]');pause(.5)uicontrol(hfigure,'style','edit','units','normalized','position',[0,0.8,1,0.12],...'backgroundcolor','[1,0.5,0]','string','520快乐','fontsize',40,'foregroundcolor','[1,0,1]');pause(.5)uicontrol(hfigure,'style','edit','units','normalized','position',[0,0.8,1,0.12],...'backgroundcolor','[1,1,1]','string','520快乐','fontsize',40,'foregroundcolor','[1,1,1]');pause(.5)uicontrol(hfigure,'style','edit','units','normalized','position',[0,0.8,1,0.12],...'backgroundcolor','[1,1,0]','string','520快乐','fontsize',40,'foregroundcolor','[1,1,1]');toc

关于“matlab怎么实现动态表白图的绘制”这篇文章的内容就介绍到这里,感谢各位的阅读!相信大家对“matlab怎么实现动态表白图的绘制”知识都有一定的了解,大家如果还想学习更多知识,欢迎关注恰卡编程网行业资讯频道。

展开全文
内容来源于互联网和用户投稿,文章中一旦含有亚博电竞手机版的联系方式务必识别真假,本站仅做信息展示不承担任何相关责任,如有侵权或涉及法律问题请联系亚博电竞手机版删除

最新文章

网站地图