Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function AE3613HW6P1()
- %AE3613 Homework #6
- %Christopher Bates
- %Due 27 Oct 2016
- %Problem Number 1
- %Setting variables
- rpd = 3.14159/180; % radians per degree
- minperhr = 60;
- secpermin = 60;
- TOFhr = 2.6297; %Time of flight in hours
- TOFmin = TOFhr * minperhr;
- TOFsec = TOFmin * secpermin;
- %%%%%%From HW5 answer%%%%%%
- n = 4.3633*10^(-4); % = sqrt(mu/a^3)
- e = 0.4528; % e = eccentricity
- asd = 220; % Dr.P solution in degrees
- % Using MATLAB's Solve function
- %E1 = eccentric anomaly
- syms E1
- eqn = ((E1-e*sin(E1))==n*TOFsec); %Kepler's Eqn
- %Solution in Radians = 3.8397
- solE1 = solve(eqn,E1);
- %Solution in degrees
- solutiondeg = solE1/rpd; % = 219.997 degrees
- %Calculating error using Dr.P's values
- error = (asd-solutiondeg)/asd;
- %Percent error = 1.4118e-03% error
- i = error*100;
- j = solE1;
- fprintf('\nThe calculated eccentric anomaly is: %12.5e\n',j);
- fprintf('The calculated percent error is: %16.4e %% \n',i);
- %%%%OUTPUT%%%%
- %The calculated eccentric anomaly is: 3.83967e+00
- %The calculated percent error is: 1.4118e-03 %
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement