Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.44 KB | None | 0 0
  1. Vinf=[2.7 4 6 8];
  2. mu_m=42828;
  3. R_msoi=.576e6;
  4.  
  5. [afas,efas,pfas]=parasint(Vinf);
  6.  
  7. an_vera0=zeros(1,length(Vinf));
  8. Vr0=zeros(1,length(Vinf));
  9. Vt0=zeros(1,length(Vinf));
  10.  
  11. for j=1:length(Vinf)
  12.  
  13. c_tstar0=(1/efas(j))*((pfas(j)/R_msoi)-1);
  14. an_vera0(j)=-acos(c_tstar0);
  15. s_tstar0=sin(an_vera0(j));
  16. Vr0(j)=sqrt(mu_m/pfas(j))*efas(j)*s_tstar0;
  17. Vt0(j)=sqrt(mu_m/pfas(j))*(1+efas(j)*c_tstar0);
  18.  
  19. end
  20.  
  21. ti=time(an_vera0,efas,afas,mu_m);
  22.  
  23. for n=1:length(ti)
  24.  
  25. I=(0:3600:ti(n));
  26. options=odeset('Vectorized','on','RelTol',1e-8,'AbsTol',1e-9);
  27. [t,Y]=ode45(@(t,y) eqMotoCur(t,y),I,y0,options);
  28.  
  29. end
  30.  
  31. function [afas,efas,pfas]=parasint(Vinf)
  32.  
  33. mu_m=42828;
  34. R_m=3396.2;
  35. Rp0=R_m+400;
  36. Rpf=R_m+50;
  37. a0=zeros(1,length(Vinf));
  38. e0=zeros(1,length(Vinf));
  39. p0=zeros(1,length(Vinf));
  40. afas=zeros(1,length(Vinf));
  41. efas=zeros(1,length(Vinf));
  42. pfas=zeros(1,length(Vinf));
  43.  
  44. for j=1:length(Vinf)
  45. a0(j)=(-mu_m)/(Vinf(j)^2);
  46. e0(j)=1-Rp0/a0(j);
  47. p0(j)=a0(j)*(1-e0(j)^2);
  48.  
  49. c(1)=p0(j);
  50. c(2)=Rpf*(1-e0(j)^2);
  51. c(3)=Rpf*(1-e0(j)^2)-p0(j);
  52. Efas=roots(c);
  53. ind=(Efas>1 & isreal(Efas));
  54. efas(j)=Efas(ind);
  55. afas(j)=Rpf/(1-efas(j));
  56. pfas(j)=afas(j)*(1-efas(j)^2);
  57. end
  58.  
  59. function [ti] = time(an_vera0,efas,afas,mu_m)
  60.  
  61. ti=zeros(1,length(an_vera0));
  62. for j=1:length(an_vera0)
  63. F=2*atanh(sqrt((efas(j)-1)/(efas(j)+1))*tan(an_vera0(j)/2));
  64. T=sqrt((-afas(j))^3/mu_m)*(efas(j)*sinh(F) - F);
  65. ti(j)=-2*T;
  66. end
  67.  
  68. function [dydt] = eqMotoCur(t,y)
  69. R_m=3396.2;
  70. mu_m=42828;
  71. Cd=2.2;
  72. S=7.065e-6;
  73. m=3699.046;
  74. wE=0.24117/R_m;
  75. if abs(y(1))>R_m+250 && y(3)>0
  76. dydt(1:4)=0;
  77. else
  78. dydt=zeros(4,1);
  79. dydt(1)=y(3);
  80. dydt(2)=y(4)/y(1);
  81. dydt(3)=(-mu_m/(y(1)^2))+((y(4)^2)/y(1))-(.5*Cd)*(S/m)*...
  82. (dens(y(1)-R_m))*(sqrt((y(3)^2)+(y(4)-(wE*y(1)))^2))*y(3);
  83. dydt(4)=-(y(4)*(y(3)/y(1)))-(.5*Cd)*(S/m)*...
  84. (dens(y(1)-R_m))*(sqrt((y(3)^2)+(y(4)-(wE*y(1)))^2))*...
  85. (y(4)-(wE*y(1)));
  86. end
  87. end
  88.  
  89. function [rho] = dens(z)
  90.  
  91. load Density.mat h d
  92. d=d*10^9;
  93.  
  94. if any(h)==abs(z)
  95. j=h==abs(z);
  96. rho=d(j);
  97. elseif abs(z)<250
  98. c_tot=(find(h>=abs(z)));
  99. c=c_tot(1);
  100. H=-(h(c)-h(c-1))/(log(d(c)/d(c-1)));
  101. rho=d(c-1)*exp(-(abs(z)-h(c-1))/H);
  102. else
  103. rho=0;
  104. end
  105.  
  106. end
  107.  
  108. Unable to perform assignment because the size of the left side is
  109. 4-by-2 and the size of the right side is 4-by-5.
  110.  
  111. Error in ode45 (line 488)
  112. yout(:,idx) = yout_new;
  113.  
  114. Error in MainCur (line 59)
  115. [t,Y]=ode45(@(t,y) eqMotoCur(t,y),I,y0,options);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement