Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.76 KB | None | 0 0
  1. clear all
  2.  
  3. Vp=50;
  4.  
  5. xs=0; ys=250;
  6. xc=230;
  7.  
  8. x=xs;
  9.  
  10. i=1; t=0; dt=0.01;
  11.  
  12. while x<=xc
  13.     y = ys/xc*sqrt(xc^2-x^2);
  14.     gamma=atan(-ys/xc*(x/sqrt(xc^2-x^2)));
  15.     x=x+Vp*cos(gamma)*dt;
  16.     t=t+dt;
  17.     i=i+1;
  18.     Z(i,1)=t; Z(i,2)=x; Z(i,3)=y; Z(i,4)=gamma;
  19. end
  20.  
  21. plot(Z(:,2),Z(:,3),'Green'); grid on; hold all;
  22.  
  23. clear all
  24. Vp=50;
  25. xs=230; ys=0;
  26. xc=320;yc=0;
  27. x=xs; y=ys;
  28. a=ys/xs;
  29. b=ys-a*xs;
  30. c=yc/xc;
  31. d=yc-c*xc;
  32. gamma=atan(a);
  33. i=1; t=0; dt=0.01;
  34.  
  35. Z(i,1)=t; Z(i,2)=x; Z(i,3)=y; Z(i,4)=gamma; Z(i,5)=b;
  36. while x<=xc
  37.         a=ys/xs;
  38.         b=ys-a*xs;
  39.         gamma=atan(a);
  40.         x=x+Vp*cos(gamma)*dt;
  41.         y=a*x+b;
  42.        
  43.     t=t+dt;
  44.     i=i+1;
  45.     Z(i,1)=t; Z(i,2)=x; Z(i,3)=y; Z(i,4)=gamma; Z(i,5)=b;
  46. end
  47. plot(Z(:,2),Z(:,3),'Green');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement