www.pudn.com > Target.zip > Target.m, change:2014-11-17,size:1597b


clear; 
G=[0 12 20 50 0; 
    13 25 25 65 0; 
    26 45 20 -90 0; 
    46 75 0 0 0; 
    76 105 65 -3 0; 
    106 135 85 5 0; 
    136 165 -75 -5 0; 
    166 195 60 10 0; 
    196 205 0 0 0.1; 
    206 225 65 -85 0; 
    226 233 0 0 0.12; 
    234 245 110 80 0; 
    246 255 0 0 0.14; 
    256 270 85 25 0; 
    271 280 0 0 0.16; 
    281 295 80 15 0; 
    296 319 70 25 0; 
    320 340 -60 -25 0]; 
Vx=0;Vy=360;H=15000;S=0; 
T=zeros(18,5); 
for i=1:18 
    if(i==1) 
        T(i,1)=G(i,1); 
        T(i,2)=G(i,2); 
        T(i,3)=G(i,3); 
        T(i,5)=G(i,5); 
        T(i,4)=G(i,4); 
    else 
         T(i,1)=G(i,1)-G(i-1,2)-1; 
         T(i,2)=G(i,2)-G(i-1,2)-1; 
         T(i,3)=G(i,3); 
        T(i,5)=G(i,5); 
         T(i,4)=G(i,4); 
    end 
end 
 for i=1:18 
     if(T(i,5)==0) 
     t=linspace(T(i,1),T(i,2),100); 
     X=S+Vx*t+0.5*T(i,3)*t.^2; 
     Y=H+Vy*t+0.5*T(i,4)*t.^2; 
     plot(X,Y) 
     hold on 
     H=H+Vy*t+0.5*T(i,4)*(T(i,2)-T(i,1)).^2; 
     S=S+Vx*t+0.5*T(i,3)*(T(i,2)-T(i,1)).^2; 
     Vx=Vx+T(i,3)*(T(i,2)-T(i,1)); 
     Vy=Vy+T(i,4)*(T(i,2)-T(i,1)); 
     H=H(100); 
     S=S(100); 
     else 
       t=linspace(T(i,1),T(i,2),100); 
         V=sqrt(Vx.^2+Vy.^2); 
         R=V/T(i,5); 
          r=asin(Vy/V); 
       X=S+R*(sin(r+T(i,5)*t)-sin(r)); 
       Y=H+R*(cos(r)-cos(r+T(i,5)*t)); 
       plot(X,Y) 
     hold on 
     H=H+R*(cos(r)-cos(r+T(i,5)*(T(i,2)-T(i,1)))); 
     S=S+R*(sin(r+T(i,5)*(T(i,2)-T(i,1)))-sin(r)); 
      Vx=V*cos(r+T(i,5)*(T(i,2)-T(i,1))); 
      Vy=V*sin(r+T(i,5)*(T(i,2)-T(i,1))); 
      H=H(100); 
     S=S(100); 
     end 
 end