Advertisement
Guest User

AE3613 HW 6 Problem 1

a guest
Oct 25th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. function AE3613HW6P1()
  2. %AE3613 Homework #6
  3. %Christopher Bates
  4. %Due 27 Oct 2016
  5.  
  6. %Problem Number 1
  7. %Setting variables
  8. rpd = 3.14159/180; % radians per degree
  9. minperhr = 60;
  10. secpermin = 60;
  11. TOFhr = 2.6297; %Time of flight in hours
  12. TOFmin = TOFhr * minperhr;
  13. TOFsec = TOFmin * secpermin;
  14. %%%%%%From HW5 answer%%%%%%
  15. n = 4.3633*10^(-4); % = sqrt(mu/a^3)
  16. e = 0.4528; % e = eccentricity
  17. asd = 220; % Dr.P solution in degrees
  18.  
  19. % Using MATLAB's Solve function
  20. %E1 = eccentric anomaly
  21. syms E1
  22. eqn = ((E1-e*sin(E1))==n*TOFsec); %Kepler's Eqn
  23. %Solution in Radians = 3.8397
  24. solE1 = solve(eqn,E1);
  25.  
  26. %Solution in degrees
  27. solutiondeg = solE1/rpd; % = 219.997 degrees
  28.  
  29. %Calculating error using Dr.P's values
  30.  
  31. error = (asd-solutiondeg)/asd;
  32.  
  33. %Percent error = 1.4118e-03% error
  34. i = error*100;
  35. j = solE1;
  36. fprintf('\nThe calculated eccentric anomaly is: %12.5e\n',j);
  37. fprintf('The calculated percent error is: %16.4e %% \n',i);
  38.  
  39. %%%%OUTPUT%%%%
  40. %The calculated eccentric anomaly is: 3.83967e+00
  41. %The calculated percent error is: 1.4118e-03 %
  42. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement