资源描述:
《用MATLAB画心形图案.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、今晚找的。。。。。。无聊的时候干的这个,哎。。。1.画心行图案clearallclc[x,y,z]=meshgrid(linspace(-1.3,1.3));f=(x.^2+(9/4)*y.^2+z.^2-1).^3-x.^2.*z.^3-(9/80)*y.^2.*z.^3;p=patch(isosurface(x,y,z,f,0));set(p,'FaceColor','red','EdgeColor','none');daspect([111])view(3)camlight;lightingphongaxisoff2.动态画曲线表白,(呵呵只需要
2、把代码里的某人改成你的那个她的名字就行了)clc;h1=figure('name','爱的表达');axis([-1.51.5-20.5]);axisoff;set(gcf,'color','black');n=4;a=320;m=10^(-a);hll=line(NaN,NaN,'marker','.','linesty','-','erasemode','none','color','r');x1=[];y1=[];fortheta=pi/2:-2*pi/999:-3*pi/2r1=1+cos(theta+pi/2);x1=[x1;r1*cos(t
3、heta)];y1=[y1;r1*sin(theta)];set(hll,'xdata',x1,'ydata',y1);pause(m);endpause(1);fill(x1,y1,'r');axisoff;set(gcf,'color','black');text(-0.16*n,-0.85,'某人','fontsize',n*18,'color','b');title('心形线','fontsize',18,'color','m');disp('loveyou');pause(1);x2=[];y2=[];h22=line(NaN,NaN,'ma
4、rker','.','linesty','-','erasemode','none','color','b');fortheta=pi/2:-2*pi/999:-3*pi/2r2=1+cos(theta+pi/2);x2=[x2;r2*cos(theta)];y2=[y2;r2*sin(theta)];set(h22,'xdata',x2,'ydata',y2);pause(m^19);endh2=figure('name','爱的表达');fill(x2,y2,'r');text(-0.58,-0.7,'我爱你','fontsize',40,'col
5、or','b');text(-0.17,-1.1,'某人','fontsize',18,'color','m');axisoff;set(gcf,'color','black');pause(1);x3=[];y3=[];h33=line(NaN,NaN,'marker','.','linesty','-','erasemode','none','color','b');fortheta=pi/2:-2*pi/999:-3*pi/2r3=1+cos(theta+pi/2);x3=[x3;r3*cos(theta)];y3=[y3;r3*sin(thet
6、a)];set(h33,'xdata',x3,'ydata',y3);pause(m^19);end·赞赞赞