数模论坛

 找回密码
 注-册-帐-号
搜索
热搜: 活动 交友 discuz
查看: 7188|回复: 7

一个数学建模题

  [复制链接]
发表于 2004-4-22 00:18:39 | 显示全部楼层 |阅读模式
一慢跑者沿着他喜欢的路线跑步,有只狗看见他了,就追他,求狗的路线。
发表于 2004-4-25 23:50:38 | 显示全部楼层
不要到处都灌水啊,有了呀
发表于 2004-4-28 16:34:48 | 显示全部楼层
<FONT color=#555555>%书上的一个程序,描述一只狗追一名慢跑者的运动轨迹 </FONT><>global w;
y0=[60;70];     % initial conditions, starting point of the dog
w=10;           % w speed of the dog
options=odeset('RelTol',1e-5,'Events','on');
[t,Y]=ode23('dog',[0,20],y0,options); <>J=[];
for h=1:length(t)
   w=jogger(t(h));
   J=[J;w'];
end <>xmin=min(min(Y(:,1)),min(J(:,1)));
xmax=max(max(Y(:,1)),max(J(:,1)));
ymin=min(min(Y(:,2)),min(J(:,2)));
ymax=max(max(Y(:,2)),max(J(:,2))); <P>clf;
hold on
axis([xmin xmax ymin ymax]);
axis equal
title('The jogger and the Dog') <P>for h=1:length(t)-1
   plot([Y(h,1),Y(h+1,1)],[Y(h,2),Y(h+1,2)],'-',...
       'color','r','EraseMode','none');
   plot([J(h,1),J(h+1,1)],[J(h,2),J(h+1,2)],':',...
       'color','green','EraseMode','none');
   drawnow
   pause(0.1);
end
hold off <P>%%%%%%%%%%%%%% <P>function s=jogger(t) <P>s=[8*t;0]; <P>%%%%%%%%%%%%%% <P>function [zs,isterminal,direction]=dog(t,z,flag); <P>global w  % w=speed of the dog
X=jogger(t);
h=X-z;
nh=norm(h);
if nargin&lt;3 | isempty(flag)   % normal output
   zs=(w/nh)*h;
else
   switch(flag)
       case 'events'   % at norm(h)=0 there is a singularity
           zs=nh-1e-3; % zero crossing at pos_dog=pos_jogger
           isterminal=1;% this is a stopping event
           direction=0; % don't care if decrease or increase
       otherwise
           error(['Unknown flag:' flag]);
   end
end
发表于 2004-4-28 16:36:47 | 显示全部楼层
<></P>
<>
<TABLE  height=70 cellSpacing=0 cellPadding=0 width="100%">

<TR vAlign=top>
<TD ><FONT color=#333333>程序中用到ode23函数,解微分方程。 </FONT></TD></TR></TABLE></P>
发表于 2004-5-1 08:32:11 | 显示全部楼层
lap!
发表于 2005-5-5 22:20:13 | 显示全部楼层
书上有
发表于 2005-8-25 00:57:30 | 显示全部楼层
高中书上就有了,自己去看啊~~
发表于 2005-8-29 00:43:52 | 显示全部楼层
<>晕倒呀,,都有啦,,还在这说,,真是的,,不像话,,来个像样的呀,</P>
您需要登录后才可以回帖 登录 | 注-册-帐-号

本版积分规则

小黑屋|手机版|Archiver|数学建模网 ( 湘ICP备11011602号 )

GMT+8, 2024-5-11 12:36 , Processed in 0.056586 second(s), 20 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表