




免费预览已结束,剩余11页可下载查看
下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
中央电大毕业设计毕业论文专 业:计算机基础与应用 年 级:2004年春计算机本科学 号:041060219姓 名:倪亚非指导老师:李征2005年12月28日物理仿真模拟实验-碰撞实验倪亚非(中央电大计算机基础与应用2004年春本科)指导老师:李征 【摘要】 随着计算机的发展,计算机的应用深入到各个领域,使用Visual basic 6.0制作中学物理仿真模拟实验就是其中的一个领域。 【关键词】 仿真模拟;碰撞;Visual Basic 6.0;窗体; 【引言】 随着计算机的发展,计算机的应用深入到各个领域,使用计算机做物理仿真模拟实验即节省资源,又便捷。 实验原理 中学物理中,碰撞实验作为验证动量守衡的一种精确测量手段,而倍受推崇。碰撞实验使用气垫导轨,数字毫秒计,游标卡尺,滑块等作为实验用具。当两滑块在水平的导轨上沿直线作对心碰撞时,若略去滑块运动过程中受到的粘滞阻力和空气阻力,则两滑块在水平方向除受到碰撞时彼此相互作用的内力外,不受其它外力作用。故根据动量守衡定律,两滑块的总动量在碰撞前后保持不变。设如图1所示,滑块1和滑块2的质量分别为M1和M2,碰撞前二滑块的速度分别为V10和V20,碰撞后的速度分别为V1和V2,则根据动量守衡定律有 M1V10+M2V20=M1V1+M2V2 若写成标量的形式,即 M1V10+M2V20=M1V1+M2V2 式中各速度均为代数值,各V值的正负号决定于速度的方向与所选取的坐标轴方向是否一致,这一点要特别注意。牛顿曾提出“弹性恢复系数”概念。其定义为碰撞后的相对速度与碰撞前的相对速度的比值。一般称为恢复系数,用e表示,即: e= 当e=1时为完全弹性碰撞,e=0时为完全非弹性碰撞,一般0eM2),将滑块2置于A,B光电门之间,使V20=0 推动滑块1以速度V10去撞滑块2,碰撞后速度分别为V1,V2,则M1V10=M1V1+M2V2 碰撞前后动能的变化为:实际实验时,由于滑块运动受到一定的阻力,又由于导轨具有少许的弯曲,在A门测出的速度V1A,在B门测出的速度V2B 和V1B,都和碰撞前后瞬间相应的速度有些差异,减少差异的方法之一,是尽可能缩短碰撞点到测速光电门间的距离。办法之二是进行速度修正,因为滑块在“调平”气轨上运动时仍然有加速度。可参照图2测出3个加速度,对相应的速度进行修正 图中滑块 位置为碰撞前瞬间的位置,CD为此时二滑块挡光片中点的位置,AB为实验时光电门的正常位置。 1。AC间距离为S10,将B门移至C,测出滑块1在AC间的加速度a10。则 V10= (V1A是在门的速度) 2。CB间距离为S1,将光电门置于C,B处,测出滑块1在CB间的加速度a1,则 1= (V1是在B门的速度) 3。DB间距离为S2,将光电门置DB时,测出滑块2在DB间的加速度则:V2= (V2B是在B门的速度) (2)。完全非弹性碰撞 此时e=0,将滑块2置于光电门AB间,而且V20=0,滑块1以速度V10撞向滑块2,碰撞后二滑块粘在一起以同一速度V2运动。碰撞前后的动量关系为 M1V10=(M1+M2)V2 动能变化为 核心算法在实验中,滑块的质量和挡片的长度是可以自行设置的,为了和实际相符,滑块的速度也是可以设置的,即10或V1A是可以设置的。也就是说在实验开始时,是以知的。V1使用Scrollbar控件来控制,V1A=Scroll1.value. 那么,如何描述1B(1),2B(V2)?由实验原理可知:1.当时,即:M1V1A= M2V2BV2B=V1A2.当时,有:M1V10=M1V1+M2V2 (其中1A,M1,M2已知)设X V2B/V1A=Y 由最小二乘法求出:a+bX中a,b的值即当1,M2,V1A给定后,就可求出V2B , V1B, V2B=V1A(a+bM1/M2)将上式代入碰撞方程就可求出 V1B=V1A(1-b-aM2/M1)也就是说知道了a,b后,就可知道V1B,V2B求a,b (由实验得以下数据,即可求出a,b)滑块1质量(g)滑块2质量(g)V1A(CM/S)V1B(CM/S) V2B(CM/S)M1M1+117.162.1714.14M1M1+213.593.0210.44M1M1+314.034.019.72M1M1+412.014.337.60M1+1M1+213.111.1111.73M1+1M1+312.962.1510.57M1+1M1+411.802.708.87M1+2M1+313.240.8312.08M1+2M1+417.942.5914.86M1+1M211.741.5312.67M1+2M210.562.5312.51M1+3M210.973.3013.74M1+4M211.223.9514.73M1+2M2+113.471.4914.49M1+3M2+112.342.3214.26M1+4M2+112.753.1615.55M1+3M2+214.041.5215.00M1+4M2+211.992.1113.65 配重=50.07g M1=183.86g M2=183.40g 1表示1个配重设M1/M2=X , V2B/V1A=Y 则:XYX*XXY0.78750.82400.620156250.64890.64840.76820.420422560.498100880.55110.69280.303711210.381802080.47920.63280.229632640.303237760.82500.89470.6806250.73812750.70120.81560.491681440.571898720.60970.75170.371734090.458311490.85130.91240.724711690.776726120.74020.82830.547896040.613107661.27551.07921.626900251.37651961.54861.18462.399852251.83435311.82151.25253.317862252.28142.09451.31284.386930252.74971.21641.07571.479628961.308481481.43091.15562.047474811.653548041.64541.21962.707341162.006729841.17821.06841.388155241.258788881.35481.13841.835483041.5423043218.971817.609325.5781928921.00203747有最小二乘法可知:拟合直线Y=a+bX 的a,b可由以下公式求出 a=Yi/n bXi/n b= 由以上公式和数据可求出: a=0.517202515 b=0.437473235即:Y=0.517202515+0.437473235X到次,由实验以及最小二乘法求出了a,b。在实验开始时,M1,M2,V1A已知,那么从以上公式就可以很容易得到其他的量。 代码Form1:(进入窗体)Private Sub Command1_Click()Unload MeForm2.ShowEnd SubPrivate Sub Form_Load()Form1.Caption = :欢迎使用中学物理仿真模拟实验:Timer1.Interval = 500End SubPrivate Sub Timer1_Timer() 运动字体由Timer1触发s = Form1.Captionb = Len(s)Form1.Caption = Right(s, b - 1) + Left(s, 1)End Sub此窗体中加了段会来回运动的字体,在标题栏里。Form2: (主界面)Option ExplicitPublic flage As BooleanPublic direction1 As Boolean, direction2 As BooleanPublic v As Integer, dd As BooleanPrivate Sub Command1_Click()Dim i As Integer, j As Integer, t As IntegerIf Form8.Text1.Text = Or Form8.Text2.Text = Then 判断滑块质量输入数据t = MsgBox(请先设置滑块1的属性!, 16, 操作步骤错误) 的正确性BeepGoTo hui:End IfIf Form9.Text1.Text = Or Form9.Text2.Text = Thent = MsgBox(请先设置滑块2的属性!, 16, 操作步骤错误)BeepGoTo hui:End IfTimer1.Interval = 50 设置触发时间间隔hui:End SubPrivate Sub Command2_Click() 实验器具位置初始化Image9.Visible = TrueImage6.Left = 960Image9.Left = 4800Timer1.Interval = 0Form13.Text1.Text = Form13.Text2.Text = Form13.Text3.Text = End SubPrivate Sub Command3_Click() 使用Slider控件来设置V1ASlider1.Visible = TrueCommand3.Visible = FalseSlider1.Left = 8520Slider1.Top = 960End SubPrivate Sub data_Click() 数据处理窗口显示Form5.ShowEnd SubPrivate Sub exit_Click() 退出实验EndEnd SubPrivate Sub Label2_Click() 滑块属性1设置窗口显示Form8.ShowEnd SubPrivate Sub Label3_Click() 滑块属性2设置窗口显示Form9.ShowEnd SubPrivate Sub Image2_Click() 光电门位置调整Form2.Image9.Visible = FalseIf direction1 = False Then Image2.Left = Image2.Left + 2000 direction1 = TrueElse Image2.Left = Image2.Left - 2000 direction1 = FalseEnd IfEnd SubPrivate Sub Image3_Click() 光电门位置调整If direction2 = False Then Image3.Left = Image3.Left - 2000 direction2 = TrueElse Image3.Left = Image3.Left + 2000 direction2 = FalseEnd IfImage9.Visible = FalseEnd SubPrivate Sub Image4_Click() 计时器窗口显示Form13.ShowEnd Sub Private Sub Image6_Click() 滑块属性1设置窗口显示Form8.ShowEnd Sub Private Sub Image7_Click() 调平窗口显示Form10.ShowForm12.ShowEnd SubPrivate Sub Image8_Click() 水平窗口显示Form12.ShowEnd SubPrivate Sub Image9_Click() 滑块属性2设置窗口显示Form9.ShowEnd SubPrivate Sub mudi_Click() 实验目的窗口显示Form3.ShowEnd SubPrivate Sub step_Click() 实验步骤窗口显示Form6.ShowEnd SubPrivate Sub form2_load() flage = FalseEnd SubPrivate Sub Timer1_Timer()v = Slider1.Value Dim vv As Singlevv = vIf flage = False Then 判断是完全非弹性碰撞还是非完全弹性碰撞 If Val(Form8.Text1.Text) = Val(Form9.Text1.Text) Then M1=M2时 If Image6.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 Then Image6.Left = Image6.Left + v End If If Image9.Left 3599 + (10 - Val(Form8.Text2.Text) * 120 Then Image9.Left = Image9.Left + v End If If Image6.Left 3240 And Form13.Option1.Value = True Then Form13.Text1.Text = Val(Form8.Text2.Text) / vv End If If Image9.Left 6120 And Form13.Option1.Value = True Then Form13.Text3.Text = Val(Form9.Text2.Text) / vv End If If Image6.Left 3240 And Form13.Option2.Value = True Then Form13.Text1.Text = vv End If If Image9.Left 6120 And Form13.Option2.Value = True Then Form13.Text3.Text = vv End If ElseIf Val(Form8.Text1.Text) Val(Form9.Text1.Text) Then M1M2时 If Image6.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 And Image9.Left 3540 + (10 - Val(Form8.Text2.Text) * 120 Then dd = False End If If Image6.Left 960 And Image9.Left 4801 Then Image6.Left = Image6.Left + vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If If Image9.Left 7560 + (10 - Val(Form9.Text2.Text) * 120 And dd = False Then Image9.Left = Image9.Left + vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) End If If Image6.Left 6120 And Form13.Option1.Value = True Then Form13.Text3.Text = Val(Form9.Text2.Text) / vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) Form13.Text2.Text = Val(Form8.Text2.Text) / (vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If If Image6.Left 6120 And Form13.Option2.Value = True Then Form13.Text3.Text = vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) Form13.Text2.Text = vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If Else M1M2时 If Image6.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 Then Image6.Left = Image6.Left + v End If If Image6.Left 6200 + (10 - Val(Form8.Text2.Text) * 120 + (10 - Val(Form9.Text2.Text) * 120 Then Image6.Left = Image6.Left + vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If If Image9.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 Then Image9.Left = Image9.Left + vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) End If End If If Image6.Left 3240 And Form13.Option1.Value = True Then Form13.Text1.Text = Val(Form8.Text2.Text) / vv End If If Image6.Left 6120 And Form13.Option1.Value = True Then Form13.Text2.Text = Val(Form8.Text2.Text) / (vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If If Image9.Left 6120 And Form13.Option1.Value = True Then Form13.Text3.Text = Val(Form9.Text2.Text) / (vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) End If If Image6.Left 3240 And Form13.Option2.Value = True Then Form13.Text1.Text = vv End If If Image6.Left 6120 And Form13.Option2.Value = True Then Form13.Text2.Text = vv * (1 - 0.437473235 - 0.517202515 * Val(Form9.Text1.Text) / Val(Form8.Text1.Text) End If If Image9.Left 6120 And Form13.Option2.Value = True Then Form13.Text3.Text = vv * (0.517202515 + 0.437473235 * Val(Form8.Text1.Text) / Val(Form9.Text1.Text) End If Else 完全非弹性碰撞 If Image6.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 Then Image6.Left = Image6.Left + vv End If If Image6.Left 6350 + (10 - Val(Form8.Text2.Text) * 120 + (10 - Val(Form9.Text2.Text) * 120 Then Image6.Left = Image6.Left + vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) End If If Image9.Left 3600 + (10 - Val(Form8.Text2.Text) * 120 Then Image9.Left = Image9.Left + vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) End If If Image6.Left 3240 And Form13.Option1.Value = True Then Form13.Text1.Text = Val(Form8.Text2.Text) / vv End If If Image9.Left 6120 And Form13.Option1.Value = True Then Form13.Text3.Text = Val(Form9.Text2.Text) / (vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) Form13.Text2.Text = Val(Form8.Text2.Text) / (vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) End If If Image6.Left 3240 And Form13.Option2.Value = True Then Form13.Text1.Text = vv End If If Image9.Left 6120 And Form13.Option2.Value = True Then Form13.Text3.Text = vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) Form13.Text2.Text = vv * Val(Form8.Text1.Text) / (Val(Form8.Text1.Text) + Val(Form9.Text1.Text) End IfEnd IfEnd SubPrivate Sub yq_Click() 仪器帮助窗口显示Form7.ShowEnd SubPrivate Sub yuanli_Click() 实验原理窗口显示Form4.ShowEnd SubForm3:(实验目的)Form4:(实验原理)Form5:(数据处理)Private Sub Command4_Click() 调用外部计算器程序Dim cal As Stringcal = Shell(C:WINDOWSSystem32calc.exe, 1)End SubForm6:(实验步骤)Private Sub Command1_Click()Form2.Image9.Left = 4800Form6.HideForm2.flage = FalseForm2.Command1.Enabled = True 保证使用者在看了实验步骤以后在开始实验End SubPrivate Sub Command2_Click() 开始非完全弹性碰撞Form2.Image9.Left = 4800Form6.HideForm2.flage = TrueForm2.Command1.Enabled = TrueEnd SubPrivate Sub Command3_Click() 开始完全非弹性碰撞Form2.Image9.Left = 7440Form6.HideForm2.flage = FalseEnd SubForm7:(仪器介绍)Form8:(滑块1属性设置)Private Sub Command1_Click()Dim t As IntegerIf Val(Text2.Text) 10 Thenf = MsgBox(请输入10以内整数!, 16, 数据输入错误)End IfEnd SubForm9:(滑块2属性设置) (和滑块1的类似)Private Sub Command1_Click()If Val(Text2.Text) 10 Thenf = MsgBox(请输入10以内整数!, 16, 数据输入错误)End IfEnd SubForm10:(调平旋钮)Private Sub Image1_Click() 右粗调If Form12.Image2.Left 1140 Then Form12.Image2.Left = Form12.Image2.Left - 20Else Form12.Image2.Left = Form12.Image2.Left + 20End IfEnd SubPrivate Sub Image2_Click() 右微调If Form12.Image2.Left 1140 Then Form12.Image2.Left = Form12.Image2.Left - 5Else Form12.Image2.Left = Form12.Image2.Left + 5End IfEnd SubPrivate Sub Image3_Click() 左粗调If Form12.Image2.Left 1140 Then Form12.Image2.Left = Form12.Image2.Left + 20Else Form12.Image2.Left = Form12.Image2.Left - 20End IfEnd SubForm12:(水平)Private Sub Form_Load() 随机确定水平位置Form12.Image2.Left = Form12.Image2.Left + Int(1001 * Rnd(1) - 400End SubForm13:(计时器窗口)Private Sub form13_load() 初始化Text1.Text = Text2.Text = Text3.Text = End SubPrivate Sub Option1_Click() 测时间档Label1.Caption = T1a:Label2.Caption = T1b:Label3.Caption = T2b:Label8.Caption = sLabel9.Caption = sLabel10.Caption = sEnd SubPrivate Sub Option2_Click() 测速度档Label1.Caption = V1a:Label2.Caption = V1b:Label3.Caption = V2b:Label8.Caption = cm/sLabel9.Caption = cm/sLabel10.Caption = cm/sEnd SubPrivate Sub Option3_Click
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 重庆市中医院儿科医保政策掌握考核
- 2024年“江南十校”新高三第一次综合素质检测生物试题
- 2025年民航维修分析报告
- 语音打包课件制作
- 语言文字政策知识培训总结课件
- 2025年中国燃料油项目创业投资方案
- 2025年中国农用菊酯项目创业计划书
- 中国柔性版材项目创业计划书
- 2025年垃圾中转站项目建设可行性研究报告
- 2025年中国氢项目商业计划书
- 《企业人力资源管理师》四级练习题库及参考答案
- 2025年全国保密教育线上培训考试题及答案
- 2025年长春吉润净月医院社会招聘模拟试卷(含答案详解)
- 2025年国网宁夏电力有限公司高校毕业生提前批招聘校园宣讲安排笔试参考题库附带答案详解
- 零工经济中的女性劳动者权益保障研究
- 2025年哈尔滨呼兰区招聘禁毒协管员30人考试参考试题及答案解析
- 2025初级注册安全工程师题库合集(+答案)
- 2025年武汉东西湖分局招聘警务辅助人员招聘73人考试参考试题及答案解析
- 小学数学人教版(2024)三年级上第三单元毫米、分米和千米测试卷(含答案)
- 聚酰亚胺行业市场现状分析报告
- 员工提成申请流程标准模板
评论
0/150
提交评论