matlab小球跳动程序

matlab小球跳动程序

ID:42992436

大小:28.01 KB

页数:3页

时间:2019-09-24

matlab小球跳动程序_第1页
matlab小球跳动程序_第2页
matlab小球跳动程序_第3页
资源描述:

《matlab小球跳动程序》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、figure(1);axis([-5.1,5,-0.05,1.05]);holdon;axis('off');fill([4.12,4.22,4.22,4.12],[-0.05,-0.05,1.05,1.05],'y');fill([-5,-3.2,-3.2,-5],[-0.05,-0.05,0,0],'g');fill([-3.2,-2.8,-2.8,-3.2],[-0.05,-0.05,0.2,0.2],'g');fill([-3.2,-1.4,-1.4,-3.2],[0.2,0.2,0.25,0.

2、25],'g');fill([-1.4,-1,-1,-1.4],[0.2,0.2,0.45,0.45],'g');fill([-1.4,0.4,0.4,-1.4],[0.45,0.45,0.5,0.5],'g');fill([0.4,0.8,0.8,0.4],[0.45,0.45,0.7,0.7],'g');fill([0.4,2.0,2.0,0.4],[0.7,0.7,0.75,0.75],'g');fill([2.0,2.3,2.3,2.0],[-0.05,-0.05,0.75,0.75],'g')

3、;fill([2.3,4.12,4.12,2.3],[-0.05,-0.05,0,0],'g');%x2=line([-5,5],[0.25,0.25],'color','g','linestyle','-','makersize',50)%line([-5,5],[0.5,0.5],'color','b','linestyle','-','markersize',50)%line([-5,5],[0.75,0.75],'color','b','linestyle','-','markersize',5

4、0)head=line(-5,1,'color','r','linestyle','.','erasemode','xor','markersize',60);%body=line(-5,1,'color','b','linestyle','-','erasemode','none');>>while1t=4;dt=0.001;w=0;dw=0.001;w=0;whilet<=4.12t=dt+t;ifw<=1w=dw+w;elsew=-1;endy=(-w*w)+1;set(head,'xdata',

5、t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endw=0;whilet>=2.11t=t-dt;ifw<=1w=dw+w;elsew=-1;endy=(-w*w)+1;set(head,'xdata',t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endw=0;whilet>=1.11t=t-dt;ifw<=1w=dw+w;elsew=-1;endy=(-w*w)/4+1;set(hea

6、d,'xdata',t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endw=-0.71;whilet>=-0.62t=t-dt;ifw<=1w=dw+w;elsew=-1;endy=(-w*w)/2+1;set(head,'xdata',t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endw=-0.71;whilet>=-2.31t=t-dt;ifw<=1w=dw+w;elsew=-1;e

7、ndy=(-w*w)/2+0.75;set(head,'xdata',t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endw=-0.71;whilet>=-4t=t-dt;ifw<=1w=dw+w;elsew=-1;endy=(-w*w)/2+0.5;set(head,'xdata',t,'ydata',y);%set(body,'xdata',t,'ydata',y);drawnow;endfori=0:0.01:200y=i+2;if(y>1

8、99)endendend

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。