您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 完全弹性碰撞-matlab
Matlab设计实验课题名称:完全弹性碰撞一.设计背景:完全弹性碰撞(PerfectElasticCollision):在理想情况下,完全弹性碰撞的物理过程满足动量守恒和能量守恒。如果两个碰撞小球的质量相等,联立动量守恒和能量守恒方程时可解得:两个小球碰撞后交换速度。如果被碰撞的小球原来静止,则碰撞后该小球具有了与碰撞小球一样大小的速度,而碰撞小球则停止。多个小球碰撞时可以进行类似的分析。二.设计意义真实情况下,由于小球间的碰撞并非理想的弹性碰撞,还会有能量的损失,所以最后小球还是要停下来。所以该设计主要用于研究能量守恒中的某些问题。还有就是用于实验演示。三.程序设计该程序主要设置了三个不同颜色的小球,在真空环境下(理想环境下)的碰撞实验演示。该程序可以通过改变各种参数,研究各种情况下的实验数据。程序:pole=1.8;%定义摆线的长度xmax=2;%定义横坐标长度ymax=2;%定义纵坐标长度basew=2.3;%定义图中方框的宽度baseh=2.3;%定义图中方框的高度instant=0.2;%定义摆线间距%三视图的初始设置%第一幅图figure('name','理想情况下能量守恒定律1','position',[500,340,440,320]);%定义第一幅图的标题和位置fill([xmax,xmax,-xmax,-xmax,xmax,xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05,xmax-0.05],[ymax,-ymax,-ymax,ymax,ymax,ymax-0.05,-ymax+0.05,-ymax+0.05,ymax-0.05,ymax-0.05],[0,1,1]);%填充底座背景holdon;%保持当前图形及坐标所有特性fill([xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05],[ymax-0.5,ymax-0.55,ymax-0.55,ymax-0.5],'g');%填充方框内横杆背景holdon;%保持当前图形及坐标所有特性text(-0.25,1.7,'1');text(0,1.7,'2');text(0.25,1.7,'3');%在坐标处标识说明文字text(-1.0,1.7,'a');text(-1.0,-1.7,'b');%在坐标处标识说明文字text(1.0,1.7,'真空容器');text(-1.8,1.7,'主视图');%在坐标处标识说明文字axis([-basew,basew,-baseh,baseh]);%定义背景坐标范围在x(-2.3~2.3)Y(-2.3~2.3)之间%axis('off');%覆盖坐标刻度并填充背景theta0=7*pi/6;%摆线1的初始角度x0=pole*cos(theta0);%摆线1末端x坐标y0=pole*sin(theta0)+1.5;%摆线1末端y坐标body1=line([-instant,x0-instant],[1.5,y0],'color','r','linestyle','-','erasemode','xor');%设置摆线1head1=line(x0-instant,y0,'color','r','linestyle','.','erasemode','xor','markersize',40);%设置第一个小球颜色,大小theta1=3*pi/2;%摆线2,3的角度x1=pole*cos(theta1);%摆线2,3末端x坐标y1=pole*sin(theta1)+1.5;%摆线2,3末端y坐标body=line([-0.001,x1],[1.5,y1],'color','k','linestyle','-','erasemode','xor');%设置摆线2head=line(x1,y1,'color','k','linestyle','.','erasemode','xor','markersize',40);%设置第2个小球颜色,大小body2=line([instant;x1+instant],[1.5;y1],'color','b','linestyle','-','erasemode','xor');%设置摆线3head2=line(x1+instant,y1,'color','b','linestyle','.','erasemode','xor','markersize',40);%设置第3个小球颜色,大小theta3=15*pi/6;%第二幅图figure('name','理想情况下能量守恒定律2','position',[500,40,440,320]);%定义第一幅图的标题和位置fill([xmax,xmax,-xmax,-xmax,xmax,xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05,xmax-0.05],[ymax,-ymax,-ymax,ymax,ymax,ymax-0.05,-ymax+0.05,-ymax+0.05,ymax-0.05,ymax-0.05],[0,1,1]);%填充底座背景holdon;%保持当前图形及坐标所有特性fill([xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05],[ymax-0.5,ymax-0.55,ymax-0.55,ymax-0.5],'g');%填充方框内第一根横杆背景holdon;%保持当前图形及坐标所有特性fill([xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05],[-ymax+0.55,-ymax+0.5,-ymax+0.5,-ymax+0.55],'b');%填充方框内第二根横杆背景holdon;%保持当前图形及坐标所有特性text(-0.25,1.7,'1');text(0,1.7,'2');text(0.25,1.7,'3');%在坐标处标识说明文字text(-1.0,1.7,'a');text(-1.0,-1.7,'b');%在坐标处标识说明文字text(1.0,1.7,'真空容器');text(-1.8,1.7,'俯视图');%在坐标处标识说明文字axis([-basew,basew,-baseh,baseh]);%定义背景坐标范围在x(-2.3~2.3)Y(-2.3~2.3)之间%axis('off');%覆盖坐标刻度并填充背景y01=0;%设置摆球纵坐标值body11=line([-instant,x0-instant],[1.5,y01],'color','r','linestyle','-','erasemode','xor');%设置摆线1上摆线body12=line([-instant,x0-instant],[-1.5,y01],'color','r','linestyle','-','erasemode','xor');%设置摆线1下摆线head01=line(x0-instant,y01,'color','r','linestyle','.','erasemode','xor','markersize',40);%设置第一个小球颜色,大小body01=line([-0.001,x1],[1.5,y01],'color','k','linestyle','-','erasemode','xor');%设置摆线2上摆线body02=line([-0.001,x1],[-1.5,y01],'color','k','linestyle','-','erasemode','xor');%设置摆线2下摆线head00=line(x1,y01,'color','k','linestyle','.','erasemode','xor','markersize',40);%设置第二个小球颜色,大小body21=line([instant;x1+instant],[1.5;y01],'color','b','linestyle','-','erasemode','xor');%设置摆线3上摆线body22=line([instant;x1+instant],[-1.5;y01],'color','b','linestyle','-','erasemode','xor');%设置摆线3下摆线head02=line(x1+instant,y01,'color','b','linestyle','.','erasemode','xor','markersize',40);%设置第三个小球颜色,大小%第三幅图figure('name','理想情况下能量守恒定律3','position',[50,340,440,320]);%定义第三幅图的标题和位置fill([xmax,xmax,-xmax,-xmax,xmax,xmax-0.05,xmax-0.05,-xmax+0.05,-xmax+0.05,xmax-0.05],[ymax,-ymax,-ymax,ymax,ymax,ymax-0.05,-ymax+0.05,-ymax+0.05,ymax-0.05,ymax-0.05],[0,1,1]);%填充底座背景holdon%保持当前图形及坐标所有特性text(1.0,1.7,'真空容器');text(-1.8,1.7,'侧视图');%在坐标处标识说明文字text(-1.7,1.5,'a');text(1.7,1.5,'b');%在坐标处标识说明文字axis([-basew,basew,-baseh,baseh]);%定义背景坐标范围在x(-2.3~2.3)Y(-2.3~2.3)之间%axis('off');%覆盖坐标刻度并填充背景x01=0;x02=1.48;y02=1.48;%设置坐标head000=line(-x02,y02,'color','g','linestyle','.','erasemode','xor','markersize',18);%设置横杆ahead000=line(x02,y02,'color','g','linestyle','.','erasemode','xor','markersize',18);%设置横杆bbody311=line([-x02,x01],[y02,y0],'color','r','linestyle','-','erasemode','xor');%设置摆线1上摆线body312=line([x02,x01],[y02,y0],'color','r','linestyle','-','erasemode','xor');%设置摆线1下摆线head301=line(x01,y0,'color','r','linestyle','.','erasemode','xor','markersize',40);%设置摆球1body301=line([-x02,x01],[y02,y1],'color','k','linestyle','-','erasemode','xor');%设置摆线2上摆线body302=line([x02,x01],[y02,y1],'color','k','linestyle','-','erasemode','xor');%设置摆线2下摆线head300=line(x01,y1,'color','k','linestyle','.','erasemode','xor','markersize',40);%设置摆球2body321=line([-x02;x01],[y02;y1],'color','b','linestyle','-','erasemode','xor');%设置摆线3上摆线body322=line([x02;x01],[y02;y1],'color','b','linestyle','-','erasemode','xor');%设置摆线3下摆线head302=line(x
本文标题:完全弹性碰撞-matlab
链接地址:https://www.777doc.com/doc-1443535 .html