可直接运行 MATLAB动画制作 模拟龟兔赛跑动画 多人围绕足球场追逐游戏动画效果 源程序代码.rar

上传者: 27595745 | 上传时间: 2022-01-02 09:03:33 | 文件大小: 3KB | 文件类型: RAR
clear all close all clc % straight line 1 of the athletic track x1=-10:0.2:10; y1=0*x1+5; % semi-circle 1 of the athletic track theta=pi/2:-0.04:-pi/2; x2=5*cos(theta)+10; y2=5*sin(theta); % straight line 2 of the athletic track x3=10:-0.2:-10; y3=0*x3-5; % semi-circle 2 of the athletic track theta=3*pi/2:-0.04:pi/2; x4=5*cos(theta)-10; y4=5*sin(theta); % Include straight lines and semi-circles to get an entire athletic track x=[x1 x2 x3 x4]; y=[y1 y2 y3 y4]; % Two cycles of the athletic track x=[x x]; y=[y y]; % plot the athletic track plot(x,y) axis([-16,16,-6,6]) axis equal hold on for i=1:length(x) k1=fix(1.1*i); % define velocity of the 1st player (uniform velocity) if k1>length(x) k1=length(x); end h1=plot(x(k1),y(k1),'Color',[1 0 0],'Marker','o','LineWidth',5); % show location of the 1st player k2=fix(1+5*i^(0.76)); % define velocity of the 2nd player (faster at the beginning, then slower) if k2>length(x) k2=length(x); end h2=plot(x(k2),y(k2),'Color',[k2/length(x) 0 k2/length(x)],'Marker','s','LineWidth',5); % show location of the 2nd player

文件下载

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明