📄 runanimation.m
字号:
axes(slidingaxes);
cla;
hold on;
ii=begintime;
while(ii<=endtime)
if stopflag
break
end
if ~pauseflag
NewPak(:,3)=ii-Pak(:,2);
outputlinesp=find((NewPak(:,3)>=0) & (NewPak(:,3)<=plotheight+timestep) & (Pak(:,3)~=Inf));
lostlinesp=find((NewPak(:,3)>=0) & (NewPak(:,3)<=plotheight+timestep) & (Pak(:,3)==Inf));
NewPak([outputlinesp ;lostlinesp],4)=Pak([outputlinesp ;lostlinesp],2);
NewPak([outputlinesp ;lostlinesp],6)=0;
NewPak(outputlinesp ,5)=ii; NewPak(outputlinesp ,7)=slopep*NewPak(outputlinesp ,3);
NewAck(:,3)=ii-Ack(:,2);
outputlinesa=find((NewAck(:,3)>=0) & (NewAck(:,3)<=plotheight+timestep) &(Ack(:,3)~=Inf));
lostlinesa=find((Ack(:,3)==Inf) & (NewAck(:,3)<=plotheight+timestep) & (NewAck(:,3)>=0));
NewAck([outputlinesa ;lostlinesa],4)=Ack([outputlinesa ;lostlinesa],2);
NewAck([outputlinesa ;lostlinesa],6)=plotheight;
NewAck(outputlinesa ,5)=ii; NewAck(outputlinesa ,7)=plotheight-slopea*NewAck(outputlinesa,3);
clear p_xx; clear p_yy; clear plose_xx; clear plose_yy;
p_xx=NewPak(outputlinesp,4:5)';
p_yy=NewPak(outputlinesp,6:7)';
plose_xx=[NewPak(lostlinesp,4) NewPak(lostlinesp,4)+timestep]';
plose_yy=[NewPak(lostlinesp,6) NewPak(lostlinesp,6)+slopep*timestep]';
textout=[outputlinesp ;lostlinesp];
textxx=NewPak(textout,4)+plotwidth/60;
textyy1=(NewPak(textout,6)+plotheight/16);
textyy2=(NewPak(textout,6)+plotheight/8);
clear a_xx; clear a_yy; clear alose_xx; clear alose_yy;
a_xx=NewAck(outputlinesa,4:5)';
a_yy=NewAck(outputlinesa,6:7)';
alose_xx=[NewAck(lostlinesa,4) NewAck(lostlinesa,4)+timestep]';
alose_yy=[NewAck(lostlinesa,6) NewAck(lostlinesa,6)-slopea*timestep]';
onslidebar;
plot(p_xx,p_yy,'r-');
if (length(plose_xx)~=0)
plot(plose_xx,plose_yy,'r-','LineWidth',2);
end
plot(a_xx,a_yy,'b-')
if (length(alose_xx)~=0)
plot(alose_xx, alose_yy ,'b-','LineWidth',2);
end
for jj=1:length(textxx)
if isempty(find(textxx_arr==textxx(jj)))
tmph1=text(textxx(jj),textyy1(jj),num2str(Pak(textout(jj),1)),'fontsize',12,'fontweight','bold','Color','k','Clipping','on');
tmph2=text(textxx(jj),textyy2(jj),num2str(Pak(textout(jj),4)),'fontsize',12,'fontweight','bold','Color','r','Clipping','on');
if ((textxx(jj)>=startpoint+plotwidth) | (textxx(jj)<=startpoint))
set(tmph1,'Visible','off');
set(tmph2,'Visible','off');
end
texth1=[texth1 tmph1];
texth2=[texth2 tmph2];
textxx_arr=[textxx_arr textxx(jj)];
end
end
ii=ii+timestep;
end
pause(0.5);
end
hold off;
set(hbstart,'Enable','on');
set(hbpause,'Enable','off');
set(hbstop,'Enable','off');
set(hbsimulation,'Enable','on');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -