《数学建模第三次作业——追击问题(共8页).doc》由会员分享,可在线阅读,更多相关《数学建模第三次作业——追击问题(共8页).doc(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上数学建模实验报告机械工程及自动化75班丁鑫四人追击问题问题:在一个边长为1的正方形跑道的四个顶点上各站有一人,他们同时开始以等速顺时针追逐下一人,在追逐过程中,每个人时刻对准目标,试模拟追击路线。并讨论:(1) 四个人能否追到一起?(2)若能追到一起,则每个人跑过多少路程?(3)追到一起所需要的时间(设速率为1)?(4)如果四个人追逐的速度不一样,情况又如何呢分析:先建立坐标系,设计程序使从A,B,C,D四个点同时出发,画出图形并判断。程序设计流程:四个人追击的速度相等,则有。针对这种情形,可有以下的程序。hold onaxis(0 2 0 2);gridA=0,0;
2、B=0,1;C=1,1;D=1,0;k=0;s1=0;s2=0;s3=0;s4=0; %四个人分别走过的路程t=0; v=1;dt=0.002;while k10000 k=k+1; plot(A(1),A(2),r.,markersize,15); plot(B(1),B(2),b.,markersize,15); plot(C(1),C(2),m.,markersize,15); plot(D(1),D(2),k.,markersize,15); e1=B-A;d1=norm(e1); e2=C-B;d2=norm(e2); e3=D-C;d3=norm(e3); e4=A-D;d4=no
3、rm(e4); fprintf(k=%.0f ,k) fprintf(A(%.2f,%.2f) d1=%.2f ,A(1),A(2),d1) fprintf(B(%.2f,%.2f) d2=%.2f ,B(1),B(2),d2) fprintf(C(%.2f,%.2f) d3=%.2f ,C(1),C(2),d3) fprintf(D(%.2f,%.2f) d4=%.2fn,D(1),D(2),d4) A=A+v*dt*e1/d1; B=B+v*dt*e2/d2; C=C+v*dt*e3/d3; D=D+v*dt*e4/d4; t=t+dt; s1=s1+v*dt; s2=s2+v*dt; s
4、3=s3+v*dt; s4=s4+v*dt; if norm(A-C)=5.0e-3&norm(B-D)=5.0e-3 break endendts1s2s3s4部分运行结果:k=481 A(0.52,0.52) d1=0.04 B(0.52,0.48) d2=0.04 C(0.48,0.48) d3=0.04 D(0.48,0.52) d4=0.04k=482 A(0.52,0.52) d1=0.04 B(0.52,0.48) d2=0.04 C(0.48,0.48) d3=0.04 D(0.48,0.52) d4=0.04k=483 A(0.52,0.52) d1=0.04 B(0.52,
5、0.48) d2=0.04 C(0.48,0.48) d3=0.04 D(0.48,0.52) d4=0.04k=484 A(0.52,0.51) d1=0.04 B(0.51,0.48) d2=0.04 C(0.48,0.49) d3=0.04 D(0.49,0.52) d4=0.04k=485 A(0.52,0.51) d1=0.04 B(0.51,0.48) d2=0.04 C(0.48,0.49) d3=0.04 D(0.49,0.52) d4=0.04k=486 A(0.52,0.51) d1=0.03 B(0.51,0.48) d2=0.03 C(0.48,0.49) d3=0.0
6、3 D(0.49,0.52) d4=0.03k=487 A(0.52,0.51) d1=0.03 B(0.51,0.48) d2=0.03 C(0.48,0.49) d3=0.03 D(0.49,0.52) d4=0.03k=488 A(0.52,0.51) d1=0.03 B(0.51,0.48) d2=0.03 C(0.48,0.49) d3=0.03 D(0.49,0.52) d4=0.03k=489 A(0.52,0.51) d1=0.03 B(0.51,0.48) d2=0.03 C(0.48,0.49) d3=0.03 D(0.49,0.52) d4=0.03k=490 A(0.5
7、2,0.50) d1=0.03 B(0.50,0.48) d2=0.03 C(0.48,0.50) d3=0.03 D(0.50,0.52) d4=0.03k=491 A(0.52,0.50) d1=0.02 B(0.50,0.48) d2=0.02 C(0.48,0.50) d3=0.02 D(0.50,0.52) d4=0.02k=492 A(0.52,0.50) d1=0.02 B(0.50,0.48) d2=0.02 C(0.48,0.50) d3=0.02 D(0.50,0.52) d4=0.02k=493 A(0.51,0.50) d1=0.02 B(0.50,0.49) d2=0
8、.02 C(0.49,0.50) d3=0.02 D(0.50,0.51) d4=0.02k=494 A(0.51,0.50) d1=0.02 B(0.50,0.49) d2=0.02 C(0.49,0.50) d3=0.02 D(0.50,0.51) d4=0.02k=495 A(0.51,0.50) d1=0.02 B(0.50,0.49) d2=0.02 C(0.49,0.50) d3=0.02 D(0.50,0.51) d4=0.02k=496 A(0.51,0.50) d1=0.01 B(0.50,0.49) d2=0.01 C(0.49,0.50) d3=0.01 D(0.50,0
9、.51) d4=0.01k=497 A(0.51,0.49) d1=0.01 B(0.49,0.49) d2=0.01 C(0.49,0.51) d3=0.01 D(0.51,0.51) d4=0.01k=498 A(0.51,0.49) d1=0.01 B(0.49,0.49) d2=0.01 C(0.49,0.51) d3=0.01 D(0.51,0.51) d4=0.01k=499 A(0.50,0.49) d1=0.01 B(0.49,0.50) d2=0.01 C(0.50,0.51) d3=0.01 D(0.51,0.50) d4=0.01k=500 A(0.50,0.50) d1
10、=0.01 B(0.50,0.50) d2=0.01 C(0.50,0.50) d3=0.01 D(0.50,0.50) d4=0.01k=501 A(0.50,0.50) d1=0.01 B(0.50,0.50) d2=0.01 C(0.50,0.50) d3=0.01 D(0.50,0.50) d4=0.01k=502 A(0.50,0.50) d1=0.00 B(0.50,0.50) d2=0.00 C(0.50,0.50) d3=0.00 D(0.50,0.50) d4=0.00t = 1.0040s1 = 1.0040s2 = 1.0040s3 = 1.0040s4 =1.0040从
11、运行的结果来看,如果四个人的追击速度相同,均为1,可有以下的结果:(1) 四人最后可以追到一起。(2) 每个人跑过相等的路程,均为1.0040.(3) 追到一起的时间为1.0040秒。如果四个人追击的速度不一样,可取,运行程序。运行程序:hold onaxis(0 2 0 2);gridA=0,0;B=0,1;C=1,1;D=1,0;k=0;s1=0;s2=0;s3=0;s4=0; %四个人分别走过的路程t=0; v=1;dt=0.001;while k10000 k=k+1; plot(A(1),A(2),r.,markersize,15); plot(B(1),B(2),b.,marker
12、size,15); plot(C(1),C(2),m.,markersize,15); plot(D(1),D(2),k.,markersize,15); e1=B-A;d1=norm(e1); e2=C-B;d2=norm(e2); e3=D-C;d3=norm(e3); e4=A-D;d4=norm(e4); fprintf(k=%.0f ,k) fprintf(A(%.2f,%.2f) d1=%.2f ,A(1),A(2),d1) fprintf(B(%.2f,%.2f) d2=%.2f ,B(1),B(2),d2) fprintf(C(%.2f,%.2f) d3=%.2f ,C(1),
13、C(2),d3) fprintf(D(%.2f,%.2f) d4=%.2fn,D(1),D(2),d4) A=A+v*dt*e1/d1; B=B+2*v*dt*e2/d2; C=C+2*v*dt*e3/d3; D=D+v*dt*e4/d4; t=t+dt; s1=s1+v*dt; s2=s2+v*dt; s3=s3+v*dt; s4=s4+v*dt; if norm(A-C)=1.0e-3&norm(B-D)=1.0e-3 break endendts1s2s3s4部分运行结果:k=662 A(0.41,0.32) d1=0.06 B(0.43,0.27) d2=0.00 C(0.43,0.2
14、7) d3=0.00 D(0.43,0.27) d4=0.05k=663 A(0.41,0.32) d1=0.05 B(0.43,0.27) d2=0.00 C(0.43,0.27) d3=0.00 D(0.43,0.27) d4=0.05k=664 A(0.41,0.32) d1=0.05 B(0.43,0.27) d2=0.00 C(0.43,0.27) d3=0.00 D(0.43,0.27) d4=0.05k=665 A(0.41,0.32) d1=0.05 B(0.43,0.27) d2=0.00 C(0.43,0.27) d3=0.00 D(0.43,0.28) d4=0.05k=
15、666 A(0.41,0.31) d1=0.05 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.04k=667 A(0.41,0.31) d1=0.04 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.04k=668 A(0.41,0.31) d1=0.04 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.04k=669 A(0.41,0.31) d1=0.04 B(0.43,0
16、.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.04k=670 A(0.41,0.31) d1=0.04 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.04k=671 A(0.41,0.31) d1=0.03 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.03k=672 A(0.41,0.31) d1=0.03 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00
17、 D(0.43,0.28) d4=0.03k=673 A(0.41,0.31) d1=0.03 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.03k=674 A(0.41,0.31) d1=0.03 B(0.43,0.28) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.28) d4=0.03k=675 A(0.41,0.31) d1=0.03 B(0.43,0.28) d2=0.00 C(0.43,0.29) d3=0.00 D(0.43,0.28) d4=0.03k=676 A(0.41
18、,0.31) d1=0.02 B(0.43,0.29) d2=0.00 C(0.43,0.28) d3=0.00 D(0.43,0.29) d4=0.02k=677 A(0.41,0.31) d1=0.02 B(0.43,0.28) d2=0.00 C(0.43,0.29) d3=0.00 D(0.43,0.29) d4=0.02k=678 A(0.42,0.30) d1=0.02 B(0.43,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.02k=679 A(0.42,0.30) d1=0.02 B(0.42,0.29) d2=0.
19、00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.02k=680 A(0.42,0.30) d1=0.02 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.02k=681 A(0.42,0.30) d1=0.02 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.01k=682 A(0.42,0.30) d1=0.01 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.
20、29) d4=0.01k=683 A(0.42,0.30) d1=0.01 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.01k=684 A(0.42,0.30) d1=0.01 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.01k=685 A(0.42,0.30) d1=0.01 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.01k=686 A(0.42,0.30) d1=0.01 B(0.42,0.29) d2=0.00 C(0.42,0.29) d3=0.00 D(0.42,0.29) d4=0.00t = 0.6860s1 = 0.6860s2 = 1.3720s3 = 1.3720s4 =0.6860从运行的结果来看,如果四个人的追击速度不同,可有以下的结果:(1) 四人最后可以追到一起。(2) 每个人跑过路程不相等,见运行结果。(3) 追到一起的时间为0.6860秒。专心-专注-专业