导弹追踪问题
clear;clfh=0.001;%时间步长
k=1;
t(1)=0;x(1)=0;y(1)=0;%初始值
while x<=30
x(k+1)=x(k)+400*h/sqrt(1+((90*t(k)-y(k))/(30-x(k)))^2)+eps;
y(k+1)=y(k)+400*h/sqrt(1+((30-x(k))/(90*t(k)-y(k)))^2)+eps;
t(k+1)=h*k;
k=k+1;
endfor i=1:30000
plot(x(1:i),y(1:i),'r-',[-1 32],[0 0],'k',[30 30],[0 y(i)],'b.-');
text(4,7,'导弹追踪'); axis equal; hold on;
m(i)=getframe;
hold off;
end
movie(m);
导弹追踪问题 运行时
>> clear
>> missile
Warning: Divide by zero.
> In missile at 8
??? Index exceeds matrix dimensions.
Error in ==> missile at 15
plot(x(1:i),y(1:i),'r-',[-1 32],[0 0],'k',[30 30],[0 y(i)],'b.-');
请问 这是哪里出错了 还有运行时 坐标会动